From 85cac110be193ba6cb7b4ad25c7ee79f4a520c33 Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Thu, 23 Mar 2023 09:35:41 -0400 Subject: [PATCH] Change test runner to pytest. Signed-off-by: Chris PeBenito --- README.md | 7 +++++-- pyproject.toml | 4 ++++ tox.ini | 5 +++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 816263e..d9b3352 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ addition to the development packages from the above list: To run SETools unit tests, the following packages are required, in addition to the above dependencies: +* pytest * tox (optional) ### Obtaining SETools @@ -130,9 +131,11 @@ for up-to-date information on build and install options, respectively. One goal for SETools is to provide confidence in the validity of the output for the tools. The unit tests for SETools can be run with -the following command +the following commands: + ``` - $ python setup.py test + $ python setup.py build_ext -i + $ pytest tests ``` ## Features diff --git a/pyproject.toml b/pyproject.toml index e5ac58c..d4f6b47 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,7 @@ [build-system] requires = ["setuptools", "Cython>=0.27"] build-backend = "setuptools.build_meta" + +[tool.pytest.ini_options] +addopts = ["--import-mode=importlib",] +pythonpath = "." diff --git a/tox.ini b/tox.ini index 59bd5e5..737ab61 100644 --- a/tox.ini +++ b/tox.ini @@ -18,7 +18,7 @@ deps = {[testenv]deps} commands_pre = coverage --version coverage erase {envpython} setup.py build_ext -i -commands = coverage run setup.py test -q +commands = coverage run -m pytest tests coverage report [testenv:lint] @@ -48,9 +48,10 @@ commands = mypy -p setools passenv = USERSPACE_SRC deps = networkx>=2.0 cython>=0.27 + pytest py36: dataclasses py38: cython>=0.29.14 py39: networkx>=2.6 py39: cython>=0.29.14 commands_pre = {envpython} setup.py build_ext -i -commands = {envpython} setup.py test -q +commands = pytest tests