diff --git a/CHANGELOG.md b/CHANGELOG.md index 94efd8db..aa3a569d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed * Fix a bug where `import` refers would incorrectly be applied to all import modules in the same form (#1274) + * Suppress pytest assertion rewrite warning for basilisp when running `basilisp test` (#1252) ### Removed * Removed support for Python 3.9 (#1283) diff --git a/src/basilisp/cli.py b/src/basilisp/cli.py index d761d6ed..833f0b90 100644 --- a/src/basilisp/cli.py +++ b/src/basilisp/cli.py @@ -745,6 +745,16 @@ def test( "Cannot run tests without dependency PyTest. Please install PyTest and try again.", ) else: + # `basilisp` declares the testrunner as a pytest plugin, so + # pytest tries to import it for assertion rewriting. Since + # it's already imported, pytest emits a warning. As rewriting + # isn't needed, we ignore it. (Requires pytest >=8.4.0 to take + # effect) + extra = [ + "-W", + "ignore:Module already imported so cannot be rewritten; basilisp:pytest.PytestAssertRewriteWarning", + ] + extra + sys.exit(pytest.main(args=list(extra)))