forked from maciej-gol/tenant-schemas-celery
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-tests
executable file
·35 lines (29 loc) · 846 Bytes
/
run-tests
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
#!/usr/bin/env python
import subprocess
import os
def main():
new_environ = os.environ.copy()
new_environ["DJANGO_SETTINGS_MODULE"] = "test_app.settings"
cwd = os.path.abspath(os.path.join(os.path.dirname(__file__), "test_app"))
subprocess.check_call(
["./manage.py makemigrations"],
shell=True,
env=new_environ.copy(),
cwd=cwd,
)
celery_proc = subprocess.Popen(
["celery", "worker", "-A", "tenant_schemas_celery.test_app:app", "-l", "INFO"],
env=new_environ.copy(),
cwd=cwd,
)
try:
subprocess.check_call(
["pytest", "../tenant_schemas_celery/tests.py"],
env=new_environ.copy(),
cwd=cwd,
)
finally:
celery_proc.terminate()
celery_proc.wait()
if __name__ == "__main__":
main()