Browse Source

tests: configure pytest (#597)

Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
pull/598/head
Henry Schreiner 3 months ago committed by GitHub
parent
commit
741585115a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      noxfile.py
  2. 10
      pyproject.toml
  3. 2
      requirements-test.txt
  4. 2
      tests/test_logger.py

6
noxfile.py

@ -36,14 +36,13 @@ def tests(session):
session.create_tmp()
session.install("-r", "requirements-test.txt")
session.install("-e", ".[tox_to_nox]")
tests = session.posargs or ["tests/"]
session.run(
"pytest",
"--cov=nox",
"--cov-config",
"pyproject.toml",
"--cov-report=",
*tests,
*session.posargs,
env={"COVERAGE_FILE": f".coverage.{session.python}"},
)
session.notify("cover")
@ -57,8 +56,7 @@ def conda_tests(session):
"--file", "requirements-conda-test.txt", "--channel", "conda-forge"
)
session.install("-e", ".", "--no-deps")
tests = session.posargs or ["tests/"]
session.run("pytest", *tests)
session.run("pytest", *session.posargs)
@nox.session

10
pyproject.toml

@ -21,6 +21,16 @@ exclude_lines = [
"@overload",
]
[tool.pytest.ini_options]
minversion = "6.0"
addopts = ["-ra", "--strict-markers", "--strict-config"]
xfail_strict = true
filterwarnings = ["error"]
log_cli_level = "info"
testpaths = [
"tests",
]
[tool.mypy]
files = ["nox"]
python_version = "3.7"

2
requirements-test.txt

@ -1,6 +1,6 @@
flask
myst-parser
pytest
pytest>=6.0
pytest-cov
sphinx>=3.0
sphinx-autobuild

2
tests/test_logger.py

@ -64,7 +64,7 @@ def test_formatter(caplog):
[
# This currently fails due to some incompatibility between caplog and colorlog
# that causes caplog to not collect the asctime from colorlog.
pytest.param(True, id="color", marks=pytest.mark.xfail),
pytest.param(True, id="color", marks=pytest.mark.xfail(strict=False)),
pytest.param(False, id="no-color"),
],
)

Loading…
Cancel
Save