Remove test runner script
This commit is contained in:
108
run_tests.py
108
run_tests.py
@@ -1,108 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
Test runner script for vgui-cicd project.
|
||||
Provides convenient shortcuts for running different test suites.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
|
||||
def main():
|
||||
"""Run tests based on command line arguments."""
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'VorgabenUI.settings')
|
||||
|
||||
if len(sys.argv) > 1:
|
||||
command = sys.argv[1]
|
||||
|
||||
if command == 'all':
|
||||
# Run all tests
|
||||
execute_from_command_line(['manage.py', 'test', '--verbosity=2'])
|
||||
|
||||
elif command == 'cache':
|
||||
# Run only cache tests
|
||||
execute_from_command_line(['manage.py', 'test', 'diagramm_proxy', '--verbosity=2'])
|
||||
|
||||
elif command == 'render':
|
||||
# Run only rendering tests
|
||||
execute_from_command_line(['manage.py', 'test', 'abschnitte.tests', '--verbosity=2'])
|
||||
|
||||
elif command == 'commands':
|
||||
# Run only management command tests
|
||||
execute_from_command_line(['manage.py', 'test', 'abschnitte.management.commands', '--verbosity=2'])
|
||||
|
||||
elif command == 'coverage':
|
||||
# Run tests with coverage
|
||||
try:
|
||||
import coverage
|
||||
cov = coverage.Coverage(source=['.'])
|
||||
cov.start()
|
||||
|
||||
execute_from_command_line(['manage.py', 'test', '--verbosity=2'])
|
||||
|
||||
cov.stop()
|
||||
cov.save()
|
||||
|
||||
print('\n' + '='*70)
|
||||
print('COVERAGE REPORT')
|
||||
print('='*70)
|
||||
cov.report()
|
||||
|
||||
print('\nHTML coverage report generated in htmlcov/')
|
||||
cov.html_report()
|
||||
|
||||
except ImportError:
|
||||
print('ERROR: coverage.py not installed.')
|
||||
print('Install with: pip install coverage')
|
||||
sys.exit(1)
|
||||
|
||||
elif command == 'fast':
|
||||
# Run tests with failfast
|
||||
execute_from_command_line(['manage.py', 'test', '--failfast', '--verbosity=2'])
|
||||
|
||||
elif command == 'help':
|
||||
print_help()
|
||||
|
||||
else:
|
||||
# Pass through to Django test runner
|
||||
execute_from_command_line(['manage.py', 'test'] + sys.argv[1:])
|
||||
|
||||
else:
|
||||
print_help()
|
||||
|
||||
|
||||
def print_help():
|
||||
"""Print help message."""
|
||||
help_text = """
|
||||
Usage: python run_tests.py [command]
|
||||
|
||||
Commands:
|
||||
all Run all tests
|
||||
cache Run diagram cache tests only
|
||||
render Run rendering tests only
|
||||
commands Run management command tests only
|
||||
coverage Run tests with coverage report
|
||||
fast Run tests with fail-fast option
|
||||
help Show this help message
|
||||
|
||||
Advanced:
|
||||
You can also pass standard Django test arguments:
|
||||
python run_tests.py <app_label>
|
||||
python run_tests.py <app_label.TestCase>
|
||||
python run_tests.py <app_label.TestCase.test_method>
|
||||
|
||||
Examples:
|
||||
python run_tests.py all
|
||||
python run_tests.py cache
|
||||
python run_tests.py coverage
|
||||
python run_tests.py diagramm_proxy.test_diagram_cache.DiagramCacheTestCase
|
||||
python run_tests.py abschnitte.tests.RenderTextabschnitteTestCase.test_render_diagram_success
|
||||
|
||||
For more options, see Documentation/TESTING.md
|
||||
"""
|
||||
print(help_text)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user