Skip to content

Commit

Permalink
Fix documentation of getter support matrix (#1913)
Browse files Browse the repository at this point in the history
Replace pytest-json with pytest-json-report and make modifications to
support new format.
  • Loading branch information
ogenstad committed May 8, 2023
1 parent 4af4391 commit 27ccd56
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ env

test/unit/test_devices.py

.report.json
report.json
tags
.pytest_cache/
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,13 +371,13 @@ def build_getters_support_matrix(app):
if not (m.startswith("_") or m in EXCLUDE_METHODS)
}

regex_name = re.compile(r"(?P<driver>\w+)\/.*::test_(?P<getter>\w+)")
regex_name = re.compile(r"test.*/(?P<driver>\w+)\/.*::test_(?P<getter>\w+)")

filename = "./support/tests/report.json"
with open(filename, "r") as f:
data = json.loads(f.read())
for test in data["report"]["tests"]:
match = regex_name.search(test["name"])
for test in data["tests"]:
match = regex_name.search(test["nodeid"])
if match:
driver = match.group("driver")
drivers.add(driver)
Expand Down
6 changes: 3 additions & 3 deletions docs/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ CWD=`pwd`
TEST_RESULTS_PATH="$CWD/support/tests"
REPOBASE=$CWD/..

if [ ! -f "report.json" ]; then
if [ ! -f ".report.json" ]; then
set -e
py.test --rootdir $REPOBASE -c /dev/null --cov=./ -vs --json=report.json $REPOBASE/test*/*/test_getters.py
pytest --rootdir $REPOBASE -c /dev/null --json-report --cov=./ -vs $REPOBASE/test*/*/test_getters.py

set -e
cp report.json $TEST_RESULTS_PATH/report.json
cp .report.json $TEST_RESULTS_PATH/report.json
fi
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ddt==1.6.0
flake8-import-order==0.18.2
pytest==7.2.2
pytest-cov==4.0.0
pytest-json==0.4.0
pytest-json-report==1.5.0
pyflakes==3.0.1
pylama==8.4.1
mock==5.0.1
Expand Down

0 comments on commit 27ccd56

Please sign in to comment.