Repository navigation
Move all stdlib tests in the test package #93839
Description
Activity
- addedtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Jun 15, 2022 It seems like the Windows installer only treat Lib/test/ separately: see Tools/msi/test/test.wixproj. I would be nice to also exclude the other test directories to make Python installation smaller on Windows.
$ du -sh ctypes/test/ distutils/tests/ idlelib/idle_test/ lib2to3/tests/ tkinter/test/ unittest/test/ 348K ctypes/test/ 336K distutils/tests/ 624K idlelib/idle_test/ 440K lib2to3/tests/ 284K tkinter/test/ 700K unittest/test/The total is about 2 732 KB.
On Fedora 36, the Python 3.10 tests (python3-test package) take around 54 MB in total (it includes idle_test, ctypes tests, etc.).
$ sudo dnf install python3-test (...) Total download size: 9.7 M Installed size: 54 MDo you think that it's worth it to move these directories?
Yes, yes, yes!
This appears to duplicate #54781.
I'm still in favor :)
Reacted by Ezio MelottiI started with:
Please leave idlelib/idle_test alone. Following gives some of reasons:
#54781 (comment)
There are also several references to files in this directory in idlelib and idlelib.test_idle files.Could you exclude idle and distutils from your list, and attach the new PRs to the other ticket?
I merged my ctypes and unittest PRs. Ok, let's continue in issue #54781.
PR #94043 broke testing on all WebAssembly platforms.
Commit #94043 used this ticket as reference.
There are actually two problems:
- Lib/test/test_unittest/init.py fails when a submodule raises SkipTest. This was supported before.
- Re-running uses wrong interpreter to re-run the test, reported as "Re-running failed tests in verbose mode" does not use host runner #94052
# wasmtime run --mapdir .::../../ -- python.wasm -m test -v test_unittest == CPython 3.12.0a0 (heads/main-dirty:c735d545343, Jun 21 2022, 09:30:50) [Clang 14.0.4 (https://github.com/llvm/llvm-project 29f1039a7285a5c3a9c353d05414 == wasi-0.0.0-wasm32-32bit little-endian == cwd: /python-wasm/cpython/builddir/wasi/build/test_python_859108æ == CPU count: 1 == encodings: locale=UTF-8, FS=utf-8 0:00:00 Run tests sequentially 0:00:00 [1/1] test_unittest Failed to call load_tests: Traceback (most recent call last): File "/Lib/unittest/loader.py", line 130, in loadTestsFromModule return load_tests(self, tests, pattern) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Lib/test/test_unittest/testmock/__init__.py", line 14, in load_tests __import__(modname) ^^^^^^^^^^^^^^^^^^^ File "/Lib/test/test_unittest/testmock/testasync.py", line 9, in <module> support.requires_working_socket(module=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Lib/test/support/__init__.py", line 543, in requires_working_socket raise unittest.SkipTest(msg) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unittest.case.SkipTest: requires socket support test test_unittest crashed -- Traceback (most recent call last): File "/Lib/test/libregrtest/runtest.py", line 360, in _runtest_inner refleak = _runtest_inner2(ns, test_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Lib/test/libregrtest/runtest.py", line 317, in _runtest_inner2 test_runner() ^^^^^^^^^^^^^ File "/Lib/test/libregrtest/runtest.py", line 280, in _test_module raise Exception("errors while loading tests") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Exception: errors while loading tests test_unittest failed (uncaught exception) == Tests result: FAILURE == 1 test failed: test_unittest Total duration: 132 ms Tests result: FAILURE- added a commit that references this issue
on Jun 21, 2022 - added a commit that references this issue
on Jun 26, 2022 What's about Modules/_decimal/tests? Is it eligible for moving?
- bench.py - move to pyperformance
- formathelper.py, randdec.py, randfloat.py - convert these generators to unittest subtests
- README.txt, runall-memorydebugger.sh, runall.bat - port to unittest and merge there
- bignum.py, deccheck.py, formathelper.py, randdec.py, randfloat.py
What's about Modules/_decimal/tests? Is it eligible for moving?
It's not installed by
make install, so I care less about this one :-)Are the issues mentioned by Christian resolved? Can we close this?
Yes, they are.
Reacted by Erlend E. Aasland- added a commit that references this issue
on Dec 22, 2022
Currently, Python tests are scattered in multiple directories:
idlelib, ctypes, lib2to3, tkinter, unittest and distutils have their tests under their own packages. It causes multiple issues:
TESTSUBDIRSvariable.I propose to move ctypes, idlelib, tkinter and unittest tests under Lib/test/.
For distutils and lib2to3, maybe we can just leave them where they are, since both modules are deprecated. distutils should be removed in Python 3.12. lib2to3 is scheduled for removal in Python 3.13.
Do you think that it's worth it to move these directories?