pypa / distlib

A low-level library which implements some Python packaging standards (PEPs) and which could be used by third-party packaging tools to achieve interoperability.
http://distlib.readthedocs.io/
Other
49 stars 38 forks source link

Test issues with Python 3.13 #208

Closed hroncok closed 11 months ago

hroncok commented 11 months ago

Describe the bug

Hello. In Fedora, we are testing our Python packages with Python 3.13.0a1 to discover problems early. distlib is one of the packages that fails with it.

To Reproduce Steps to reproduce the behavior:

  1. tox -e py313

Expected behavior Tests pass

Actual behavior

======================================================================
FAIL: test_script_run (test_scripts.ScriptTestCase.test_script_run)
----------------------------------------------------------------------
Traceback (most recent call last):
  File ".../pypa/distlib/tests/test_scripts.py", line 335, in test_script_run
    self.assertIn(b'<H3>Current Working Directory:</H3>', stdout)
AssertionError: b'<H3>Current Working Directory:</H3>' not found in b''

----------------------------------------------------------------------
Ran 216 tests in 26.446s

FAILED (failures=1, skipped=24)

Environment

Additional information

I believe that the called subprocess fails (the call does not check that) and the error is in stderr (the test does not display that). The cig module was removed in Python 3.13, see https://docs.python.org/3.13/whatsnew/3.13.html


I also accidentally found out that there are removed unittest functions used in test_version.py, however hose are not used when running the testsuite via tox. To reproduce, run:

$ .tox/py313/bin/python tests/test_version.py 
Traceback (most recent call last):
  File ".../pypa/distlib/tests/test_version.py", line 668, in <module>
    unittest.main(defaultTest="test_suite")
  File "/usr/lib64/python3.13/unittest/main.py", line 103, in __init__
    self.parseArgs(argv)
  File "/usr/lib64/python3.13/unittest/main.py", line 142, in parseArgs
    self.createTests()
  File "/usr/lib64/python3.13/unittest/main.py", line 153, in createTests
    self.test = self.testLoader.loadTestsFromNames(self.testNames,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/unittest/loader.py", line 207, in loadTestsFromNames
    suites = [self.loadTestsFromName(name, module) for name in names]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/unittest/loader.py", line 192, in loadTestsFromName
    test = obj()
           ^^^^^
  File ".../pypa/distlib/tests/test_version.py", line 648, in test_suite
    suite = [unittest.makeSuite(VersionTestCase),
             ^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.13/unittest/__init__.py", line 80, in __getattr__
    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
AttributeError: module 'unittest' has no attribute 'makeSuite'

The makeSuite thing was also removed in Python 3.13.

vsajip commented 11 months ago

Thanks for the report!