Skip to content

Commit

Permalink
tests: add coverage for unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nmoutschen committed Jan 20, 2020
1 parent fc22246 commit f93a41f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 10 additions & 0 deletions shared/tests/unit/coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[run]
branch = True

[report]
# Omit dependencies
omit =
*/build/src/*/six.py
*/build/src/*/*/*
show_missing = True
fail_under = 90
10 changes: 6 additions & 4 deletions tools/toolbox
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,15 @@ class ToolBox:
os.environ["BUILD_DIR"] = self.build_dir

# Inject shared modules for unit tests in the PYTHONPATH
tests_modules = os.path.join(self.shared_dir, "tests", "unit")
shared_tests = os.path.join(self.shared_dir, "tests", "unit")
if os.environ.get("PYTHONPATH", "") != "":
os.environ["PYTHONPATH"] = "{}:{}".format(tests_modules, os.environ["PYTHONPATH"])
os.environ["PYTHONPATH"] = "{}:{}".format(shared_tests, os.environ["PYTHONPATH"])
else:
os.environ["PYTHONPATH"] = tests_modules
os.environ["PYTHONPATH"] = shared_tests

process = subprocess.run(["pytest", tests_dir])
process = subprocess.run(["pytest", tests_dir,
"--cov", self.build_dir,
"--cov-config", os.path.join(shared_tests, "coveragerc")])
process.check_returncode()

def cmd_tests_integ(self):
Expand Down

0 comments on commit f93a41f

Please sign in to comment.