-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrun_server_tests.py
More file actions
53 lines (40 loc) · 1.4 KB
/
run_server_tests.py
File metadata and controls
53 lines (40 loc) · 1.4 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
46
47
48
49
50
51
52
53
#!/usr/bin/env python3
"""
Test runner script for PyStackQL.
This script runs all the PyStackQL tests in server mode. It can be used to run
individual test files or all tests.
A running instance of the stackql server is required to run the server tests.
Examples:
# Run all tests
python run_server_tests.py
# Run specific test files
python run_server_tests.py tests/test_server.py
# Run with verbose output
python run_server_tests.py -v
"""
import sys
import os
import pytest
from termcolor import colored
# Add the current directory to the Python path
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
# Add the tests directory to the Python path
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), 'tests')))
def main():
"""Run the tests."""
print(colored("\n===== PyStackQL Server Test Runner =====\n", "cyan"))
# Default pytest arguments
args = ["-v"]
# Add any specific test files passed as arguments
if len(sys.argv) > 1:
args.extend(sys.argv[1:])
else:
# If no specific tests were requested, run all non-server test files
args.extend([
"tests/test_server.py",
"tests/test_server_magic.py"
])
# Run pytest with the arguments
return pytest.main(args)
if __name__ == "__main__":
sys.exit(main())