2019-01-23 06:49:30 +08:00
|
|
|
import os
|
|
|
|
import subprocess
|
|
|
|
import sys
|
|
|
|
|
2019-01-23 23:20:25 +08:00
|
|
|
from . import PostgreSQLSimpleTestCase
|
2019-01-23 06:49:30 +08:00
|
|
|
|
|
|
|
|
|
|
|
class PostgresIntegrationTests(PostgreSQLSimpleTestCase):
|
|
|
|
def test_check(self):
|
2019-05-15 01:43:56 +08:00
|
|
|
test_environ = os.environ.copy()
|
|
|
|
if "DJANGO_SETTINGS_MODULE" in test_environ:
|
|
|
|
del test_environ["DJANGO_SETTINGS_MODULE"]
|
|
|
|
test_environ["PYTHONPATH"] = os.path.join(os.path.dirname(__file__), "../../")
|
2019-01-23 06:49:30 +08:00
|
|
|
result = subprocess.run(
|
|
|
|
[
|
|
|
|
sys.executable,
|
|
|
|
"-m",
|
|
|
|
"django",
|
|
|
|
"check",
|
|
|
|
"--settings",
|
|
|
|
"integration_settings",
|
|
|
|
],
|
|
|
|
stdout=subprocess.DEVNULL,
|
|
|
|
stderr=subprocess.PIPE,
|
2019-02-06 00:01:36 +08:00
|
|
|
cwd=os.path.dirname(__file__),
|
2019-11-02 23:00:10 +08:00
|
|
|
env=test_environ,
|
|
|
|
encoding="utf-8",
|
2019-01-23 06:49:30 +08:00
|
|
|
)
|
2019-11-02 23:00:10 +08:00
|
|
|
self.assertEqual(result.returncode, 0, msg=result.stderr)
|