diff --git a/.copier-answers.yml b/.copier-answers.yml index db4dfe029ad3868f24fb3908ca7ecf9e9bb3b722..1fae2313d17d6a51fcf390f4660d64c000fef75c 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: v0.1.6 +_commit: v0.2.0 _src_path: https://gitlab.softwareheritage.org/swh/devel/swh-py-template.git description: Software Heritage search service distribution_name: swh-search diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8957bec6128b471c890816598b471a0116b18f7e..9d458216bd8207d9dca53030c622dedb2e6a883f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,4 +41,13 @@ repos: pass_filenames: false language: system types: [python] - + - id: twine-check + name: twine check + description: call twine check when pushing an annotated release tag + entry: bash -c "ref=$(git describe) && + [[ $ref =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && + (python3 -m build --sdist && twine check $(ls -t dist/* | head -1)) || true" + pass_filenames: false + stages: [pre-push] + language: python + additional_dependencies: [twine, build] diff --git a/pytest.ini b/pytest.ini index 61aeeba048eb437f95fb87dda6a38d31f75e56c9..fe398a0babf5a774f332240c7ce22d38f7330ba1 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,4 +1,4 @@ [pytest] norecursedirs = build docs .* asyncio_mode = strict -addopts = "--import-mode=importlib" +consider_namespace_packages = true diff --git a/requirements-test.txt b/requirements-test.txt index 199473d737bc71c15ec7d5b1bdc14417b935e142..958480aa697026cc665a199c396080fb5b299f7a 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,5 +1,5 @@ confluent-kafka -pytest +pytest >= 8.1 pytest-mock swh.core[testing] types-click diff --git a/tox.ini b/tox.ini index 29f188dd5b66e68cc857ff44465aa0da503e0a2b..f3dcced4c706431326e0817d2f3e0d3167908dbc 100644 --- a/tox.ini +++ b/tox.ini @@ -7,6 +7,7 @@ envlist = py3 [testenv] +usedevelop = true passenv = YARN extras = testing @@ -14,14 +15,10 @@ deps = pytest-cov commands = pytest --doctest-modules \ - --rootdir {envsitepackagesdir} \ - --cov={envsitepackagesdir}/swh/search \ + --cov=swh/search \ --cov-branch \ - {envsitepackagesdir}/swh/search \ + swh/search \ {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