Skip to content

Commit

Permalink
tests: Add coverage testing
Browse files Browse the repository at this point in the history
This commit adds coverage testing to the existing test suite.
Additionally it provides a separate `test_with_report` nox entry that
can be used to generate html reports in the internal CI.

Internal-tag: [#52078]
Signed-off-by: Robert Winkler <rwinkler@antmicro.com>
  • Loading branch information
rw1nkler committed Dec 22, 2023
1 parent 03b7db8 commit ac313b2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
6 changes: 5 additions & 1 deletion .ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ pytest:
- python3 -m pip install -r requirements.dev.txt
- python3 -m pip install git+https://github.com/antmicro/tuttest
- tuttest README.md | bash -
- nox -s tests
- nox -s tests_with_report
artifacts:
paths:
- cov_html

docs-verify:
stage: test
Expand All @@ -43,6 +46,7 @@ docs-build:
- echo -en "\nhtml_js_files = [ '$ANNOTANT' ]" >> source/conf.py
- make html latexpdf
- cp build/latex/*.pdf build/html/
- cp -r ../cov_html build/html/cov
- tar cf ../$CI_DOCS_ARCHIVE -C build/html/ .
artifacts:
paths:
Expand Down
9 changes: 7 additions & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,10 @@ def black_check(session):
@nox.session
def tests(session: nox.Session) -> None:
session.install("-r", "requirements.txt")
session.install("-r", "requirements.dev.txt")
session.run("pytest", "tests")
session.run("pytest", "--cov=fpga_topwrap", "tests")


@nox.session
def tests_with_report(session: nox.Session) -> None:
session.install("-r", "requirements.txt")
session.run("pytest", "--cov-report", "html:cov_html", "--cov=fpga_topwrap", "tests")
1 change: 1 addition & 0 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ flake8
nox
pre-commit
pytest
pytest-cov
pytest-lazy-fixtures

0 comments on commit ac313b2

Please sign in to comment.