Debian Codegraph @

tests/postgres_tests/test_integration.py

raw
1 import os
2 import subprocess
3 import sys
4
5 from . import PostgreSQLSimpleTestCase
6
7
8 class PostgresIntegrationTests(PostgreSQLSimpleTestCase):
9 def test_check(self):
10 test_environ = os.environ.copy()
11 if "DJANGO_SETTINGS_MODULE" in test_environ:
12 del test_environ["DJANGO_SETTINGS_MODULE"]
13 test_environ["PYTHONPATH"] = os.path.join(os.path.dirname(__file__), "../../")
14 result = subprocess.run(
15 [
16 sys.executable,
17 "-m",
18 "django",
19 "check",
20 "--settings",
21 "integration_settings",
22 ],
23 stdout=subprocess.DEVNULL,
24 stderr=subprocess.PIPE,
25 cwd=os.path.dirname(__file__),
26 env=test_environ,
27 encoding="utf-8",
28 )
29 self.assertEqual(result.returncode, 0, msg=result.stderr)