Skip to content

Commit

Permalink
tests: configure pytest (#597)
Browse files Browse the repository at this point in the history
Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com>
  • Loading branch information
henryiii committed Apr 20, 2022
1 parent 4399ec5 commit 7415851
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
6 changes: 2 additions & 4 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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
Expand Down
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
flask
myst-parser
pytest
pytest>=6.0
pytest-cov
sphinx>=3.0
sphinx-autobuild
Expand Down
2 changes: 1 addition & 1 deletion tests/test_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
],
)
Expand Down

0 comments on commit 7415851

Please sign in to comment.