-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_tests.py
More file actions
45 lines (37 loc) · 1.16 KB
/
run_tests.py
File metadata and controls
45 lines (37 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
"""
Script to run all tests for the GHGI Dataset Discovery Agent.
This is a convenience wrapper around pytest.
"""
import os
import sys
import subprocess
def run_tests():
"""Run all tests using pytest."""
# Get the directory containing this script
root_dir = os.path.dirname(os.path.abspath(__file__))
# Determine the tests directory
tests_dir = os.path.join(root_dir, "tests")
# Print test header
print("\n" + "="*70)
print("Running tests for GHGI Dataset Discovery Agent")
print("="*70)
# Build pytest command
pytest_args = [
"pytest",
tests_dir,
"-v", # Verbose output
"--color=yes" # Colorized output
]
# Add any additional arguments passed to this script
pytest_args.extend(sys.argv[1:])
# Print the command being run
print(f"Running command: {' '.join(pytest_args)}\n")
# Run pytest
try:
result = subprocess.run(pytest_args, check=False)
return result.returncode
except Exception as e:
print(f"Error running tests: {e}")
return 1
if __name__ == "__main__":
sys.exit(run_tests())