Skip to content

Commit c123eb9

Browse files
authored
suppress pytest rewrite assertion warning (#1279)
Hi, can you please consider patch to suppress the pytest rewrite assertion warning when running `basilisp test`. It fixes #1252. I haven’t added a test, as it would require creating a virtual environment during testing, which seemed excessive for this issue. However, I’m happy to add one if you feel it’s necessary. Thanks Note: this is a follow up to #1255 but it uses the `;` separator to specify the module name, introduced by pytest-dev/pytest#13429 in [Pytest 8.4.0](https://docs.pytest.org/en/stable/changelog.html#pytest-8-4-0-2025-06-02). --------- Co-authored-by: ikappaki <[email protected]>
1 parent f643d88 commit c123eb9

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010

1111
### Fixed
1212
* Fix a bug where `import` refers would incorrectly be applied to all import modules in the same form (#1274)
13+
* Suppress pytest assertion rewrite warning for basilisp when running `basilisp test` (#1252)
1314

1415
### Removed
1516
* Removed support for Python 3.9 (#1283)

src/basilisp/cli.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -745,6 +745,16 @@ def test(
745745
"Cannot run tests without dependency PyTest. Please install PyTest and try again.",
746746
)
747747
else:
748+
# `basilisp` declares the testrunner as a pytest plugin, so
749+
# pytest tries to import it for assertion rewriting. Since
750+
# it's already imported, pytest emits a warning. As rewriting
751+
# isn't needed, we ignore it. (Requires pytest >=8.4.0 to take
752+
# effect)
753+
extra = [
754+
"-W",
755+
"ignore:Module already imported so cannot be rewritten; basilisp:pytest.PytestAssertRewriteWarning",
756+
] + extra
757+
748758
sys.exit(pytest.main(args=list(extra)))
749759

750760

0 commit comments

Comments
 (0)