Repository navigation
Run the unit tests on Linux, macOS and Windows - #99
Merged
Merged
Conversation
test_matlab_test_runner faked Windows by setting os.name to "nt". That also switches pathlib to WindowsPath, which cannot be created anywhere else, so on macOS and Linux the next Path() raised, and pytest crashed while reporting it, taking the whole unit run down with it. The runner now asks _is_windows(), which the tests patch instead, and two new tests cover the Windows install search and the Windows executable check on any platform. CI ran only the models, spectrum and oversampling unit tests, on Ubuntu. It now runs all of tests/unit on Ubuntu, macOS and Windows. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The crash:
python/tests/unit/test_matlab_test_runner.pyfaked Windows withmonkeypatch.setattr(runner.os, "name", "nt").runner.osis the globalosmodule, so pathlib also switched toWindowsPath, which cannot be instantiated on macOS or Linux. The nextPath(...)raised. pytest then crashed with an INTERNALERROR while formatting that failure, which stopped the wholetests/unitrun.The fix:
matlab/tests/run_matlab_tests.pygets_is_windows(), and its twoos.name == "nt"checks use it.runner._is_windowsinstead ofos.name, so the Windows branch is exercised on every platform.%ProgramFiles%\MATLABcome newest release first;.cmd/.batfiles are accepted, and.exefiles only with a real PE signature.CI: until now CI ran only
tests/unit/models,spectrumandoversampling, and only on Ubuntu. A newunit-testsjob runs all oftests/uniton ubuntu-latest, macos-latest and windows-latest (fail-fast: false). The three partial steps are removed from the examples job, and the example runs are unchanged.Tested: locally on macOS (Python 3.11),
pytest tests/unitgives 892 passed, 1 xfailed; before this change it aborted. Windows is checked only by this PR's CI.🤖 Generated with Claude Code