Open sbrugman opened 1 month ago
We actually had a subtle bug in the previous implementation: when --show-stderr
was provided, the program would exit because None
is not a valid contextmanager. The contextlib.nullcontext
is an elegant alternative for the time being.
Changes:
--show-stderr
is passedtorchfix
binary is available (used by the test)--show-stderr
Thanks! I'll double check on an x86 Mac where the issue was happening.
And I need to follow-up on https://github.com/Instagram/LibCST/issues/944 eventually to fix the root cause...
@kit1980 Github Actions also offers macOS x86 runners - I've added that one and the test pass. Windows is also included now.
I tried this on my x86 macbook, and the suppression doesn't work.
tests/test_torchfix.py::test_stderr_suppression actually passed, but running torchfix .
causes tons of noise:
torchfix .
Failed to determine module name for /Users/sdym/repos/pytorch-release/vision/examples/cpp/script_model.py: '/Users/sdym/repos/pytorch-release/vision/examples/cpp/script_model.py' is not in the subpath of '' OR one path is relative and the other is absolute. Failed to determine module name for /Users/sdym/repos/pytorch-release/vision/.github/process_commit.py: '/Users/sdym/repos/pytorch-release/vision/.github/process_commit.py' is not in the subpath of '' OR one path is relative and the other is absolute.
Pity, that version of Mac then probably outputs the stderr to stdout and leaves stderr empty...
contextlib.redirect_stderr
works on Mac, no need to additional clause