Maintenance scheduled for Thursday, September 24th at 15:00 MDT. Expected downtime <1 hour.

Added coverage command to setup.py

parent 524b8c08
......@@ -12,3 +12,4 @@ tables==3.5.2
pyinstaller==3.5
PyQt5==5.12.2
wheel
coverage==5.2
\ No newline at end of file
from setuptools import setup
import platform
import unittest
from coverage import Coverage
from distutils import cmd
import test_fluegg
try:
from sphinx.setup_command import BuildDoc
......@@ -65,4 +70,30 @@ if sphinx_imported:
'build_dir': ('setup.py', docs_build_dir),
'builder': ('setup.py', docs_builder)}}
class CoverageCommand(cmd.Command):
description = 'generates a coverage report of the fluegg unit tests'
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
cov = Coverage()
cov.start()
test_loader = unittest.defaultTestLoader
test_suite = test_fluegg.load_tests(test_loader)
unittest.TextTestRunner().run(test_suite)
cov.stop()
cov.save()
cov.html_report(omit=["*/env/*", "*/test/*", "test_fluegg.py"])
print("Coverage report built. See /htmlcov/index.html")
cmdclass['coverage'] = CoverageCommand
setup_kwargs['cmdclass'] = cmdclass
setup(**setup_kwargs)
......@@ -6,9 +6,11 @@ import unittest
absolute_path, _ = os.path.split(os.path.realpath(__file__))
module_paths = \
[path for path in glob.glob(os.path.join(absolute_path, 'test', '*.py')) if '__init__.py' not in path]
[path for path in glob.glob(os.path.join(
absolute_path, 'test', '*.py')) if '__init__.py' not in path]
nonrandom_test_module_paths = \
[path for path in glob.glob(os.path.join(absolute_path, 'test', 'nonrandom', '*.py')) if '__init__.py' not in path]
[path for path in glob.glob(os.path.join(
absolute_path, 'test', 'nonrandom', '*.py')) if '__init__.py' not in path]
module_paths.extend(nonrandom_test_module_paths)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment