Skip to content
Closed
Prev Previous commit
Next Next commit
Fixed other test_py_compile.py test
  • Loading branch information
Jack Hindmarch
Jack Hindmarch committed May 24, 2022
commit afb2620d8ba8b23f631fd2ea8e47b0f8b83a261a
4 changes: 2 additions & 2 deletions Lib/test/test_py_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,12 +235,12 @@ def pycompilecmd(self, *args, **kwargs):
# assert_python_* helpers don't return proc object. We'll just use
# subprocess.run() instead of spawn_python() and its friends to test
# stdin support of the CLI.
opts = '-m' if __debug__ else '-Om'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how this actually fixed things, but it seems to have done the trick 🤷‍♂️

if args and args[0] == '-' and 'input' in kwargs:
opts = '-m' if __debug__ else '-Om'
return subprocess.run([sys.executable, opts, 'py_compile', '-'],
input=kwargs['input'].encode(),
capture_output=True)
return script_helper.assert_python_ok('-m', 'py_compile', *args, **kwargs)
return script_helper.assert_python_ok(opts, 'py_compile', *args, **kwargs)

def pycompilecmd_failure(self, *args):
return script_helper.assert_python_failure('-m', 'py_compile', *args)
Expand Down