python / cpython

The Python programming language
https://www.python.org
Other
62.17k stars 29.88k forks source link

test_distutils: test_check_metadata_deprecated fails if docutils-0.19 are installed #98634

Open mgorny opened 1 year ago

mgorny commented 1 year ago

Bug report

If docutils-0.19 are installed system-wide while running CPython's test suite, the following test fails:

======================================================================
FAIL: test_check_metadata_deprecated (distutils.tests.test_register.RegisterTestCase.test_check_metadata_deprecated)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mgorny/git/cpython/Lib/distutils/tests/test_register.py", line 296, in test_check_metadata_deprecated
    self.assertEqual(len(w.warnings), 1)
AssertionError: 70 != 1

Apparently it's caused by multiple instances of the following warning:

/home/mgorny/git/cpython/Lib/distutils/command/check.py:128: DeprecationWarning: The frontend.OptionParser class will be replaced by a subclass of argparse.ArgumentParser in Docutils 0.21 or later.
  settings = frontend.OptionParser(components=(Parser,)).get_default_values()
/home/mgorny/git/cpython/Lib/optparse.py:1000: DeprecationWarning: The frontend.Option class will be removed in Docutils 0.21 or later.
  option = self.option_class(*args, **kwargs)

To reproduce

  1. Install docutils-0.19 using the system package manager.
  2. ./configure --prefix=/usr
  3. make -j$(nproc)
  4. make test

Your environment

sobolevn commented 1 year ago

Note: distutils is deprecated and will be removed in 3.12

mgorny commented 1 year ago

Note: distutils is deprecated and will be removed in 3.12

I know. Perhaps the simplest solution would be to remove that test.