diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8d4658a..ed4e3ef 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,6 +27,9 @@ jobs: - name: Test run: uv run pytest -v tests/ + - name: Test deprecated features + run: uv run --group=deprecated pytest -v tests/test_deprecated_package_name.py + check: name: check all unit tests pass runs-on: ubuntu-latest diff --git a/pyproject.toml b/pyproject.toml index fca877c..5dfa440 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,3 +59,6 @@ version-file = "src/pytest_artifacts/_version.py" dev = [ "ruff>=0.14.13", ] +deprecated = [ + "pytest-artifact >= 0.2.0.post2" +] diff --git a/tests/test_deprecated_package_name.py b/tests/test_deprecated_package_name.py new file mode 100644 index 0000000..4cca30a --- /dev/null +++ b/tests/test_deprecated_package_name.py @@ -0,0 +1,24 @@ +"""Test that the former name of this package `pytest-artifact` (without the 's') +is deprecated and raises a warning when used. +""" + +import pytest + +pytest_artifact = pytest.importorskip("pytest_artifact") + + +def test_pytest_artifact_raises_deprecation_warning(pytester): + """Test that importing pytest_artifact raises a deprecation warning.""" + pytester.makepyfile(""" + def test_something(artifacts): + assert artifacts.__module__.split(".")[0] == "pytest_artifact" + """) + + result = pytester.runpytest("-v") + assert result.parseoutcomes() == {"passed": 1, "warnings": 1} + result.stdout.fnmatch_lines( + [ + "*::test_something PASSED*", + "*DeprecationWarning*`pytest-artifact`*deprecated*`pytest-artifacts`*", + ] + )