Skip to content

Commit 16c3b7d

Browse files
committed
Workaround pytest warning about unknown configuration options junit_xml.
1 parent 3bc6539 commit 16c3b7d

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/ExtractConfiguration.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,13 @@ jobs:
126126
toolSection = pyProjectSettings["tool"]
127127
if "pytest" in toolSection:
128128
section = toolSection["pytest"]
129+
# TODO: will be dropped in @r8
129130
if "junit_xml" in section:
130131
unittestXMLFile = Path(section["junit_xml"])
132+
elif "addopts" in section:
133+
options = {k: v for k, v in (option.split("=") for option in section["addopts"] if "=" in option)}
134+
if "--junitxml" in options:
135+
unittestXMLFile = Path(options["--junitxml"])
131136
132137
if "pyedaa-reports" in toolSection:
133138
section = toolSection["pyedaa-reports"]

pyproject.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ cobertura_xml_report = "report/typing"
3838

3939
[tool.pytest]
4040
addopts = [
41+
"-ra",
42+
"--show-capture=all",
4143
"--tb=native",
44+
"--color=yes",
4245
"--junitxml=report/unit/UnittestReportSummary.xml"
4346
]
4447
# Don't set 'python_classes = *' otherwise, pytest doesn't search for classes
@@ -49,7 +52,6 @@ filterwarnings = [
4952
"error::DeprecationWarning",
5053
"error::PendingDeprecationWarning"
5154
]
52-
junit_xml = "report/unit/UnittestReportSummary.xml"
5355
junit_logging = "all"
5456

5557
[tool.pyedaa-reports]

run.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ $runUnitFunc = {
155155

156156
$env:PYTHONPATH="."
157157
$env:ENVIRONMENT_NAME = "Windows (x86-64)"
158-
pytest -raP --color=yes --template=html1/index.html --report=report/unit/html/index.html --split-report tests/unit
158+
pytest --template=html1/index.html --report=report/unit/html/index.html --split-report tests/unit
159159

160160
if ($copy) {
161161
& $runCopyFunc $live
@@ -177,7 +177,7 @@ $runCovFunc = {
177177

178178
$env:PYTHONPATH="."
179179
$env:ENVIRONMENT_NAME = "Windows (x86-64)"
180-
coverage run --data-file=.coverage --rcfile=pyproject.toml -m pytest -ra --color=yes tests/unit
180+
coverage run --data-file=.coverage --rcfile=pyproject.toml -m pytest tests/unit
181181

182182
if ($live) {
183183
Write-Host -ForegroundColor DarkMagenta "[live][COV] Convert coverage report to HTML ..."

0 commit comments

Comments
 (0)