Browse Source

changed isolated test runner from tox to nox

main
Holger Frey 2 years ago
parent
commit
0d05271c92
  1. 1
      .gitignore
  2. 18
      Makefile
  3. 8
      noxfile.py
  4. 24
      pyproject.toml
  5. 14
      tox.ini

1
.gitignore vendored

@ -39,6 +39,7 @@ pip-delete-this-directory.txt
# Unit test / coverage reports # Unit test / coverage reports
htmlcov/ htmlcov/
.tox/ .tox/
.nox/
.coverage .coverage
.coverage.* .coverage.*
.cache .cache

18
Makefile

@ -1,4 +1,4 @@
.PHONY: clean clean-docs clean-test clean-pyc clean-build docs help prepareenv .PHONY: clean coverage coverall docs devenv install lint prepareenv repo test testall testfunctional nox tox
.DEFAULT_GOAL := help .DEFAULT_GOAL := help
define BROWSER_PYSCRIPT define BROWSER_PYSCRIPT
@ -49,6 +49,7 @@ clean-pyc: ## remove Python file artifacts
clean-test: ## remove test and coverage artifacts clean-test: ## remove test and coverage artifacts
rm -fr .pytest_cache/ rm -fr .pytest_cache/
rm -fr .nox/
rm -fr .tox/ rm -fr .tox/
rm -f .coverage rm -f .coverage
rm -fr htmlcov/ rm -fr htmlcov/
@ -76,8 +77,11 @@ coverall: lint ## full test suite, check code coverage and open coverage report
coverage html coverage html
$(BROWSER) htmlcov/index.html $(BROWSER) htmlcov/index.html
tox: ## run fully isolated tests with tox nox: ## run fully isolated tests with nox
tox nox
tox: ## old habits die hard: typo-squatting to use nox
nox
docs: ## build the documentation using mkdocs docs: ## build the documentation using mkdocs
mkdocs build mkdocs build
@ -86,13 +90,13 @@ serve-docs: docs ## build the documentation and serve them in a web server
mkdocs serve mkdocs serve
install: ## install updated project.toml with flint install: ## install updated project.toml with flint
flit install --pth-file .venv/bin/pip3 install -e ".[dev,docs,test]"
prepareenv: ## setup a virtualenv and install basic reuqired packages prepareenv: ## setup a virtualenv and install basic reuqired packages
rm -fr .venv/
python3 -m venv --prompt sensospot_tools .venv python3 -m venv --prompt sensospot_tools .venv
.venv/bin/pip3 install --upgrade pip .venv/bin/pip3 install --upgrade pip wheel
.venv/bin/pip3 install "flit>3.2" .venv/bin/pip3 install -e ".[dev,docs,test]"
.venv/bin/flit install --pth-file
devenv: prepareenv ## setup development environment including pre commit hooks devenv: prepareenv ## setup development environment including pre commit hooks
.venv/bin/pre-commit install --install-hooks .venv/bin/pre-commit install --install-hooks

8
noxfile.py

@ -0,0 +1,8 @@
import nox
@nox.session(python=["3.9", "3.10", "3.11"])
def tests(session):
session.install(".[test]")
session.run("pytest", *session.posargs)

24
pyproject.toml

@ -37,13 +37,6 @@ Source = "https://git.cpi.imtek.uni-freiburg.de/holgi/sensospot_tools.git"
# script_name = "sensospot_tools:function" # script_name = "sensospot_tools:function"
[project.optional-dependencies] [project.optional-dependencies]
test = [
"pytest >=4.0.0",
"pytest-cov",
"pytest-mock",
"pytest-randomly",
"tox",
]
dev = [ dev = [
"black", "black",
"keyring", "keyring",
@ -54,6 +47,13 @@ docs = [
"mkdocs", "mkdocs",
"mkdocstrings[python]", "mkdocstrings[python]",
] ]
test = [
"nox",
"pytest >=4.0.0",
"pytest-cov",
"pytest-mock",
"pytest-randomly",
]
[tool.pytest.ini_options] [tool.pytest.ini_options]
@ -84,8 +84,8 @@ extend-exclude = '''
select = ["ALL"] select = ["ALL"]
ignore = [ ignore = [
# ignored for now, should be activated in the future # ignored for now, should be activated in the future
# docstrings # docstrings
"D", "D",
# flake8-annotations # flake8-annotations
"ANN", "ANN",
# flake8-type-checking # flake8-type-checking
@ -93,12 +93,12 @@ ignore = [
# ignored, "black" will handle this # ignored, "black" will handle this
# flake8-commas # flake8-commas
"COM", "COM",
# ignored, due to Windows / WSL2 setup # ignored, due to Windows / WSL2 setup
# flake8-executable # flake8-executable
"EXE", "EXE",
# project specific ignores # project specific ignores
# flake8-import-conventions # flake8-import-conventions
"ICN", "ICN",
@ -113,4 +113,4 @@ target-version = "py38"
"tests/*" = ["FBT003", "INP001", "PLR2004", "S101"] "tests/*" = ["FBT003", "INP001", "PLR2004", "S101"]
[tool.ruff.pydocstyle] [tool.ruff.pydocstyle]
convention = "pep257" # Accepts: "google", "numpy", or "pep257" convention = "pep257" # Accepts: "google", "numpy", or "pep257"

14
tox.ini

@ -1,14 +0,0 @@
[tox]
envlist = py39, py310
isolated_build = True
[testenv]
deps =
pytest
pytest-cov
pytest-mock
setuptools>=41.2.0
pip>=20.0.2
changedir = {toxinidir}/tests
commands = pytest --cov=sensospot_tools
Loading…
Cancel
Save