Skip to content

Move all stdlib tests in the test package #93839

Closed
@vstinner

Description

@vstinner

Currently, Python tests are scattered in multiple directories:

  • Lib/test/ (main one)
  • Lib/ctypes/test/
  • Lib/distutils/tests/
  • Lib/idlelib/idle_test/
  • Lib/lib2to3/tests/
  • Lib/tkinter/test/
  • Lib/unittest/test/

idlelib, ctypes, lib2to3, tkinter, unittest and distutils have their tests under their own packages. It causes multiple issues:

  • As a maintainer of Python, I have to look into these directories manually when refactoring "Python tests" (I cannot just look into Lib/test/).
  • Linux distributions have to manually put these directories into a separated packages if they want to make the main "python" package smaller, to put python tests into a separated package.
  • Makefile is more complicated since tests are installed separately, and so these directories should be listed explicitly in the TESTSUBDIRS variable.
  • Tools/scripts/generate_stdlib_module_names.py excludes manually these modules, since sys.stdlib_module_names excludes test modules.

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions