From 80fdbbf50bbace2007ef15c7e0e2c51aa924e374 Mon Sep 17 00:00:00 2001 From: Antoine Lambert <anlambert@softwareheritage.org> Date: Wed, 27 Mar 2024 14:13:55 +0100 Subject: [PATCH] tests: Simplify setup after pytest 8.1 release Since the release of pytest 8.1, some pytest options are no longer needed and editable install can be used when running tests using tox. --- pytest.ini | 3 ++- requirements-test.txt | 2 +- tox.ini | 9 +++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/pytest.ini b/pytest.ini index a604a8e..732e3bd 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,5 +1,6 @@ [pytest] -addopts = -p no:flask --import-mode=importlib +addopts = -p no:flask norecursedirs = build docs .* asyncio_mode = strict DJANGO_SETTINGS_MODULE = swh.auth.tests.django.app.apptest.settings +consider_namespace_packages = true diff --git a/requirements-test.txt b/requirements-test.txt index b4ba39f..c0f5c54 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,6 +1,6 @@ django-stubs djangorestframework-stubs -pytest +pytest >= 8.1 pytest-django pytest-mock requests_mock diff --git a/tox.ini b/tox.ini index bf03288..386638c 100644 --- a/tox.ini +++ b/tox.ini @@ -7,6 +7,7 @@ envlist = py3 [testenv] +use_develop = true extras = testing django @@ -15,14 +16,10 @@ deps = pytest-cov commands = pytest --doctest-modules \ - --rootdir {envsitepackagesdir} \ - --cov={envsitepackagesdir}/swh/auth \ + --cov=swh/auth \ --cov-branch \ - {envsitepackagesdir}/swh/auth \ + swh/auth \ {posargs} -# --rootdir (with --import-mode from pytest.ini) are required to make tests -# that depends on the test file to be a proper submodule of the swh namespace -# after migration to PEP420 (implicit namespace). [testenv:black] skip_install = true -- GitLab