GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||
GeezerVison is showing github.com — gh-131178: Add tests for `sysconfig` command-line interface by LamentXU123 · Pull Request #139934 · python/cpython Conversation
|
| check=True | ||
| ) | ||
| self.assertTrue(output.returncode == 0) | ||
| self.assertTrue(output.stdout.startswith("Platform: ")) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The docs say that all these values should be present in the text, could we check for them in the test? That way the test validates they're there (and if the output changes, know it needs to change)
get_platform(), get_python_version(), get_path() and get_config_vars().
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I will add a stricter test case by mocking an output and directly compare the mock output and the real one.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
|
||
| class CommandLineTests(unittest.TestCase): | ||
| def test_config_output(self): | ||
| output = subprocess.run( |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
From what I can see in the base issue the pattern for these tests is to use contextlib.redirect_stdout + call the function which implements main directly (sysconfig._main) rather than run / use a subprocess.
See for example: https://github.com/python/cpython/pull/131275/files#diff-eabc91c9e7a2586ffc6ca849d6636e74e28825a4515745c280b045dbdf857e39R723-R727
That should also fix the WASI check which is currently failing with: OSError: [Errno 58] wasi does not support processes.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Ah! Thank you. I am really stuck on how to fix the WASI test.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Actually we've already got this for the CLI test: So we don't need to change things(why are the CLI test mixing with others XD) .Sorry that I overlook this. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.