Skip to content

Commit

Permalink
Merge pull request #122 from pehala/reporting
Browse files Browse the repository at this point in the history
Improve reporting
  • Loading branch information
pehala authored Oct 4, 2022
2 parents b0877d3 + 8248998 commit 4d71559
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ endif
PIPENV_VERBOSITY ?= -1
PIPENV_IGNORE_VIRTUALENVS ?= 1

PYTEST = pipenv run python -m pytest --tb=$(TB)

ifdef junit
flags += --junitxml=$(resultsdir)/junit-$@.xml -o junit_suite_name=$@
PYTEST += --junitxml=$(resultsdir)/junit-$(@F).xml -o junit_suite_name=$(@F)
endif

PYTEST = pipenv run python -m pytest --tb=$(TB)
ifdef html
PYTEST += --html=$(resultsdir)/report-$(@F).html
endif

commit-acceptance: pylint mypy all-is-package

Expand Down
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ typing_extensions = "*"
pytest-xdist = "*"
pytest = "*"
pytest-asyncio = "*"
pytest-html = "*"
dynaconf = "*"
python-keycloak = "*"
backoff = "*"
Expand Down
18 changes: 18 additions & 0 deletions testsuite/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@ def term_handler():
signal.signal(signal.SIGTERM, orig)


# pylint: disable=unused-argument
def pytest_collection_modifyitems(session, config, items):
"""
Add user properties to testcases for xml output
This adds issue and issue-id properties to junit output, utilizes
pytest.mark.issue marker.
This is copied from pytest examples to record custom properties in junit
https://docs.pytest.org/en/stable/usage.html
"""

for item in items:
for marker in item.iter_markers(name="issue"):
issue = marker.args[0]
item.user_properties.append(("issue", issue))


@pytest.fixture(scope="session")
def testconfig():
"""Testsuite settings"""
Expand Down

0 comments on commit 4d71559

Please sign in to comment.