From 0c443100096d90744b956d71cacc86e4fbc29db8 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Fri, 6 Oct 2017 12:22:20 -0700 Subject: [PATCH] tests: Don't use caching session engine in tests. Because we run tests in parallel, the caching session engine can lead to nondeterministic failures. --- zerver/tests/test_home.py | 4 ++-- zerver/tests/test_presence.py | 2 +- zproject/test_settings.py | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/zerver/tests/test_home.py b/zerver/tests/test_home.py index 14ab58941f..e8b6c1ec22 100644 --- a/zerver/tests/test_home.py +++ b/zerver/tests/test_home.py @@ -174,7 +174,7 @@ class HomeTest(ZulipTestCase): with queries_captured() as queries: result = self._get_home_page(stream='Denmark') - self.assert_length(queries, 39) + self.assert_length(queries, 41) html = result.content.decode('utf-8') @@ -237,7 +237,7 @@ class HomeTest(ZulipTestCase): with queries_captured() as queries2: result = self._get_home_page() - self.assert_length(queries2, 33) + self.assert_length(queries2, 34) # Do a sanity check that our new streams were in the payload. html = result.content.decode('utf-8') diff --git a/zerver/tests/test_presence.py b/zerver/tests/test_presence.py index 4b0a5b791b..52a6d583fd 100644 --- a/zerver/tests/test_presence.py +++ b/zerver/tests/test_presence.py @@ -47,7 +47,7 @@ class ActivityTest(ZulipTestCase): with queries_captured() as queries: self.client_get('/activity') - self.assert_length(queries, 3) + self.assert_length(queries, 4) class TestClientModel(ZulipTestCase): def test_client_stringification(self): diff --git a/zproject/test_settings.py b/zproject/test_settings.py index f0d34c0e49..d4fd0f6477 100644 --- a/zproject/test_settings.py +++ b/zproject/test_settings.py @@ -93,6 +93,9 @@ CACHES['database'] = { } } +# Disable caching on sessions to make query counts consistent +SESSION_ENGINE = "django.contrib.sessions.backends.db" + # Use production config from Webpack in tests if CASPER_TESTS: WEBPACK_FILE = 'webpack-stats-production.json'