Skip to content

Commit

Permalink
Activate e3 pytest plugin
Browse files Browse the repository at this point in the history
Use e3 pytest plugin to replace ad-hoc scripts that were maintained
in all e3-* projects.

for it/org/software-supply-chain/production-pipeline/issues#48
  • Loading branch information
enzbang committed Apr 3, 2024
1 parent 4891f65 commit 63559f9
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ e3-testsuite-report = "e3.testsuite.report.display:main"
[tool.setuptools.dynamic]
version = {file = "VERSION"}

[tool.pytest.ini_options]
addopts = "--failed-first --e3"

[tool.mypy]
# Ensure mypy works with namespace in which there is no toplevel
# __init__.py. Explicit_package_bases means that that mypy_path
Expand Down
13 changes: 11 additions & 2 deletions tests/tests/test_xunit.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,12 @@ def check_log(test_name, log):

captured = capsys.readouterr()
assert captured.out == ""
assert captured.err == ""

# Ensure that stderr is empty apart from the logs that are
# activated by the e3 pytest plugin
assert not [
line for line in captured.err.splitlines() if "DEBUG" not in line
]


def test_import_dirs(tmp_path):
Expand Down Expand Up @@ -427,4 +432,8 @@ def test_dangling_xfails(tmp_path, capsys):
" bar\n"
" foo (reason)\n"
)
assert captured.err == ""
# Ensure that stderr is empty apart from the logs that are
# activated by the e3 pytest plugin
assert not [
line for line in captured.err.splitlines() if "DEBUG" not in line
]
16 changes: 3 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,19 @@ isolated_build = True

[testenv]
deps =
pytest
mock
httpretty
e3-core
e3-core[test]
cov: pytest-cov
codecov: codecov

passenv = APPVEYOR* , TRAVIS , TRAVIS_* , CI

# Run testsuite with coverage when '-cov' is in the env name
commands=
{envpython} {toxinidir}/tests/gen-cov-config.py {toxinidir}/.coveragerc
pytest --ignore=build -v \
ci: --ci \
cov: --cov e3.testsuite --cov-report= --cov-fail-under=0 \
cov: --e3-cov-rewrite {envsitepackagesdir} src \
cov: --cov e3.testsuite \
[]
cov: {envpython} {toxinidir}/tests/fix-coverage-paths.py \
cov: {envsitepackagesdir} {toxinidir}/.coverage
cov: coverage html --fail-under=0
cov: coverage report
codecov: codecov


Expand Down Expand Up @@ -56,6 +49,3 @@ commands =

[flake8]
ignore = D100,D101,D102,D102,D103,D104,D105,D106,D107,D203,D403,D213,E123,E133,E241,E242,W503,E704

[pytest]
addopts = --failed-first

0 comments on commit 63559f9

Please sign in to comment.