-
Notifications
You must be signed in to change notification settings - Fork 5
/
threadedtests.py
executable file
·37 lines (30 loc) · 894 Bytes
/
threadedtests.py
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
#!/usr/bin/env python
import argparse
from multiprocessing import Process
import os
import sys
import pytest
def main():
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.testing")
sys.path.insert(0, "src")
sys.path.insert(0, "examples/simple")
parser = argparse.ArgumentParser(description="""\nTesting.\n""")
parser.add_argument(
"-t",
"--threads",
dest="threads",
type=int,
help="Number of threads",
metavar="THREADS",
)
__args = parser.parse_args()
__threads = 5
if __args.threads:
sys.argv = sys.argv[1:]
__threads = __args.threads
__processes = [Process(target=pytest.main) for __i in range(__threads)]
for __process in __processes:
__process.start()
return [__process.join() for __process in __processes]
if __name__ == "__main__":
sys.exit(main())