diff --git a/CHANGELOG.md b/CHANGELOG.md index 092d9c10..50875d91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] + * Suppress pytest assertion rewrite warning for basilisp when running `basilisp test` (#1252) + ## [v0.4.0] ### Added * Added support for referring imported Python names as by `from ... import ...` (#1154) diff --git a/pyproject.toml b/pyproject.toml index 983e902b..ab4791bd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,7 @@ prompt-toolkit = ">=3.0.0,<4.0.0" pyrsistent = ">=0.18.0,<1.0.0" typing-extensions = ">=4.7.0,<5.0.0" -pytest = { version = ">=7.0.0,<9.0.0", optional = true } +pytest = { version = ">=8.4.0,<9.0.0", optional = true } pygments = { version = ">=2.9.0,<3.0.0", optional = true } [tool.poetry.group.dev.dependencies] @@ -45,7 +45,7 @@ black = ">=24.0.0" docutils = "*" isort = "*" pygments = "*" -pytest = ">=7.0.0,<9.0.0" +pytest = ">=8.4.0,<9.0.0" pytest-pycharm = "*" # Ensure the Sphinx version remains synchronized with docs/requirements.txt # to maintain consistent output during both development and publishing on diff --git a/src/basilisp/cli.py b/src/basilisp/cli.py index d761d6ed..8f91156e 100644 --- a/src/basilisp/cli.py +++ b/src/basilisp/cli.py @@ -745,6 +745,15 @@ 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. + extra = [ + "-W", + "ignore:Module already imported so cannot be rewritten; basilisp:pytest.PytestAssertRewriteWarning", + ] + extra + sys.exit(pytest.main(args=list(extra)))