Argument-Clinic / cpython

The Python programming language
https://www.python.org/
Other
1 stars 0 forks source link

What's up with `disabled_test_converter_arguments`? #20

Open AlexWaygood opened 1 year ago

AlexWaygood commented 1 year ago

This method in test_clinic.py is never executed, since its name does not begin with test_, and it is never called from any methods whose names do begin with test_:

https://github.com/Argument-Clinic/cpython/blob/6996b406bcf9f6d85a59e539c743ef9126c3cc5d/Lib/test/test_clinic.py#L985-L992

If I prepend test_ to the method name, it fails:

Traceback: ```pytb ====================================================================== ERROR: test_disabled_test_converter_arguments (test.test_clinic.ClinicParserTest.test_disabled_test_converter_arguments) ---------------------------------------------------------------------- Traceback (most recent call last): File "C:\Users\alexw\coding\argclinic-python\Lib\test\test_clinic.py", line 986, in test_disabled_test_converter_arguments function = self.parse_function(""" ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\alexw\coding\argclinic-python\Lib\test\test_clinic.py", line 858, in parse_function block = self.parse(text) ^^^^^^^^^^^^^^^^ File "C:\Users\alexw\coding\argclinic-python\Lib\test\test_clinic.py", line 854, in parse parser.parse(block) File "C:\Users\alexw\coding\argclinic-python\Tools\clinic\clinic.py", line 4617, in parse self.state(line) File "C:\Users\alexw\coding\argclinic-python\Tools\clinic\clinic.py", line 4870, in state_parameters_start return self.next(self.state_parameter, line) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\alexw\coding\argclinic-python\Tools\clinic\clinic.py", line 4656, in next self.state(line) File "C:\Users\alexw\coding\argclinic-python\Tools\clinic\clinic.py", line 4919, in state_parameter self.parse_parameter(param) File "C:\Users\alexw\coding\argclinic-python\Tools\clinic\clinic.py", line 5139, in parse_parameter fail(f'{name!r} is not a valid {legacy_str}converter') File "C:\Users\alexw\coding\argclinic-python\Tools\clinic\clinic.py", line 208, in fail warn_or_fail(*args, filename=filename, line_number=line_number, fail=True) File "C:\Users\alexw\coding\argclinic-python\Tools\clinic\clinic.py", line 191, in warn_or_fail raise error clinic.ClinicError: 'path_t' is not a valid converter ---------------------------------------------------------------------- ```

It seems like this method was introduced in the original commit adding argument clinic to CPython.

Should we just delete it? Fix it?

erlend-aasland commented 1 year ago

There's a path_t converter in Modules/posixmodule.c. Perhaps it was a test for an early variant of clinic that included more of those converters?

AlexWaygood commented 1 year ago

There's a path_t converter in Modules/posixmodule.c. Perhaps it was a test for an early variant of clinic that included more of those converters?

Sounds... plausible!

erlend-aasland commented 1 year ago

Are there similar tests? If not, we could borrow the code in posixmodule.c and make it a test in ClinicWholeFileTest.