[New-bugs-announce] [issue46425] Multiple test modules fail to run if invoked directly

Nikita Sobolev report at bugs.python.org
Tue Jan 18 13:41:39 EST 2022


New submission from Nikita Sobolev <mail at sobolevn.me>:

While working on a similar issue for `test_typing.py` (https://bugs.python.org/issue46416) I wondered: how many other modules also have this problem?

So, after several hours of local testing, I got several problems:
- Lib/test/test_compileall.py
  Uses relative `.` import that cannot be resolved

- Lib/test/test_distutils.py
  Is missing `import unittest` to run `unittest.main()`

- Lib/test/test_dtrace.py
  Calls undefined `test_main()` instead of  `unittest.main()`

- Lib/test/test_tools/test_freeze.py
  Uses relative `.` import that cannot be resolved

- Lib/test/test_zipfile64.py
  Imports undefined `from test.support import TESTFN`

- Lib/unittest/test/test_program.py
  Uses relative `.` import that cannot be resolved

Probably there are other problems, because I haven't checked:
- Windows tests, because I don't have a Win machine
- `test_importlib`, because it has a lot of failure (I don't know how to fix them yet)
- Multiple other modules with slow tests
- Modules with doctests which assert full `__qualname__` with module names

To keep PRs reviews sane, I will include changes for several modules and split this big task of checking all test modules into several consecutive and rather simple pull requests. 

The first one with the problems described above is on its way!

----------
components: Tests
messages: 410879
nosy: corona10, sobolevn
priority: normal
severity: normal
status: open
title: Multiple test modules fail to run if invoked directly
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46425>
_______________________________________


More information about the New-bugs-announce mailing list