Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/run-canary-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
poetry env info # display poetry's env info for debugging
poetry install --with test
- name: Run Canary Tests
run: poetry run python tom_app/tests/run_canary_tests.py
run: poetry run python tom_app/tests/run_tests.py --canary
14 changes: 0 additions & 14 deletions tom_app/tests/run_canary_tests.py

This file was deleted.

34 changes: 30 additions & 4 deletions tom_app/tests/run_tests.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
#!/usr/bin/env python
# django_shell.py
import sys

import argparse

from django.core.management import call_command
from boot_django import boot_django, APP_NAME # noqa


boot_django()
print(f'running test for {APP_NAME}')
call_command('test', *sys.argv[1:], '--exclude-tag=canary', verbosity=2)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('testname', default='', nargs='?',
help='Module paths to test; '
'can be modulename, modulename.TestCase or modulename.TestCase.test_method')
parser.add_argument('-v', '--verbosity', default=2, type=int, choices=[0, 1, 2, 3],
help='Verbosity level;'
' 0=minimal output, 1=normal output, 2=verbose output, 3=very verbose output')
parser.add_argument('--canary', action='store_true', help='Run only canary tests (skips canary tests by default)')

testname = parser.parse_args().testname
verbosity = parser.parse_args().verbosity
run_canary = parser.parse_args().canary

# We still only want to test this app's tests, so if no specific test is supplied,
# we use the app name to restrict testing
if not testname:
testname = APP_NAME

# If the canary flag is set, we want to run only the canary tests, otherwise we want to exclude them
if run_canary:
canary_command_flag = '--tag=canary'
else:
canary_command_flag = '--exclude-tag=canary'

boot_django()
print(f'running test(s) for {APP_NAME}')
call_command('test', testname, canary_command_flag, verbosity=verbosity)
Loading