diff options
author | Amber Brown <hawkowl@atleastfornow.net> | 2018-09-04 02:21:48 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-04 02:21:48 +1000 |
commit | 77055dba92af80cdfdffc30fd3084ecd24902c2e (patch) | |
tree | 1d0a9c0afdecdeae970d98c77ba4c2ff8f4f39be /tests/utils.py | |
parent | Merge pull request #3737 from matrix-org/erikj/remove_redundant_state_func (diff) | |
download | synapse-77055dba92af80cdfdffc30fd3084ecd24902c2e.tar.xz |
Fix tests on postgresql (#3740)
Diffstat (limited to 'tests/utils.py')
-rw-r--r-- | tests/utils.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/utils.py b/tests/utils.py index 63e30dc6c0..114470d641 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -30,8 +30,8 @@ from synapse.config.server import ServerConfig from synapse.federation.transport import server from synapse.http.server import HttpServer from synapse.server import HomeServer -from synapse.storage import DataStore, PostgresEngine -from synapse.storage.engines import create_engine +from synapse.storage import DataStore +from synapse.storage.engines import PostgresEngine, create_engine from synapse.storage.prepare_database import ( _get_or_create_schema_state, _setup_new_database, @@ -42,6 +42,7 @@ from synapse.util.ratelimitutils import FederationRateLimiter # set this to True to run the tests against postgres instead of sqlite. USE_POSTGRES_FOR_TESTS = os.environ.get("SYNAPSE_POSTGRES", False) +LEAVE_DB = os.environ.get("SYNAPSE_LEAVE_DB", False) POSTGRES_USER = os.environ.get("SYNAPSE_POSTGRES_USER", "postgres") POSTGRES_BASE_DB = "_synapse_unit_tests_base_%s" % (os.getpid(),) @@ -244,8 +245,9 @@ def setup_test_homeserver( cur.close() db_conn.close() - # Register the cleanup hook - cleanup_func(cleanup) + if not LEAVE_DB: + # Register the cleanup hook + cleanup_func(cleanup) hs.setup() else: |