Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rly committed Jul 26, 2023
1 parent 178b2ed commit cb9892c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run_coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:

- name: Run integration tests and generate coverage report
run: |
python -m coverage run -p test.py --integration --validation --backwards
python -m coverage run -p test.py --integration --validation-module --backwards
# validation CLI tests generate separate .coverage files that need to be merged
python -m coverage combine
python -m coverage xml # codecov uploader requires xml format
Expand Down
30 changes: 24 additions & 6 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@
import traceback
import unittest

flags = {'pynwb': 2, 'integration': 3, 'example': 4, 'backwards': 5, 'validation': 6, 'ros3': 7, 'example-ros3': 8}
flags = {
'pynwb': 2,
'integration': 3,
'example': 4,
'backwards': 5,
'validate-examples': 6,
'ros3': 7,
'example-ros3': 8,
'validation-module': 9
}

TOTAL = 0
FAILURES = 0
Expand Down Expand Up @@ -295,18 +304,21 @@ def main():
help='run example tests with ros3 streaming')
parser.add_argument('-b', '--backwards', action='append_const', const=flags['backwards'], dest='suites',
help='run backwards compatibility tests')
parser.add_argument('-w', '--validation', action='append_const', const=flags['validation'], dest='suites',
parser.add_argument('-w', '--validate-examples', action='append_const', const=flags['validate-examples'], dest='suites',
help='run example tests and validation tests on example NWB files')
parser.add_argument('-r', '--ros3', action='append_const', const=flags['ros3'], dest='suites',
help='run ros3 streaming tests')
parser.add_argument('-x', '--validation-module', action='append_const', const=flags['validation-module'], dest='suites',
help='run ros3 streaming tests')
args = parser.parse_args()
if not args.suites:
args.suites = list(flags.values())
# remove from test suites run by default
args.suites.pop(args.suites.index(flags['example']))
args.suites.pop(args.suites.index(flags['example-ros3']))
args.suites.pop(args.suites.index(flags['validation']))
args.suites.pop(args.suites.index(flags['validate-examples']))
args.suites.pop(args.suites.index(flags['ros3']))
args.suites.pop(args.suites.index(flags['validation-module']))

# set up logger
root = logging.getLogger()
Expand All @@ -329,8 +341,10 @@ def main():
run_test_suite("tests/unit", "pynwb unit tests", verbose=args.verbosity)

# Run example tests
if flags['example'] in args.suites or flags['validation'] in args.suites:
is_run_example_tests = False
if flags['example'] in args.suites or flags['validate-examples'] in args.suites:
run_example_tests()
is_run_example_tests = True

# Run example tests with ros3 streaming examples
# NOTE this requires h5py to be built with ROS3 support and the dandi package to be installed
Expand All @@ -339,13 +353,17 @@ def main():
run_example_ros3_tests()

# Run validation tests on the example NWB files generated above
if flags['validation'] in args.suites:
if flags['validate-examples'] in args.suites:
validate_nwbs()

# Run integration tests
if flags['integration'] in args.suites:
run_integration_tests(verbose=args.verbosity)

# Run validation module tests, requires coverage to be installed
if flags['validation-module'] in args.suites:
run_test_suite("tests/validation", "validation tests", verbose=args.verbosity)

# Run backwards compatibility tests
if flags['backwards'] in args.suites:
run_test_suite("tests/back_compat", "pynwb backwards compatibility tests", verbose=args.verbosity)
Expand All @@ -355,7 +373,7 @@ def main():
run_test_suite("tests/integration/ros3", "pynwb ros3 streaming tests", verbose=args.verbosity)

# Delete files generated from running example tests above
if flags['example'] in args.suites or flags['validation'] in args.suites:
if is_run_example_tests:
clean_up_tests()

final_message = 'Ran %s tests' % TOTAL
Expand Down

0 comments on commit cb9892c

Please sign in to comment.