diff options
author | Duda Dornelles <ddornell@thoughtworks.com> | 2015-02-03 09:14:10 -0200 |
---|---|---|
committer | Duda Dornelles <ddornell@thoughtworks.com> | 2015-02-03 12:36:17 -0200 |
commit | 6904acf34524b84d70d0054a5bb953a1bf9c784a (patch) | |
tree | 491716eed52ae2acaed11584add6ba13af19295f /service/test/support/integration | |
parent | ab6955b3fbc5b89ad80fcade0702b54efb9ef682 (diff) |
Enabling integration tests to be run in parallel
If we were using twisted 12.3.0, this change would allow us to run the
tests with 'trial -j <number of tests to run in parallel>'. In a simple
test in my box the integration test suite got 3x faster
Diffstat (limited to 'service/test/support/integration')
-rw-r--r-- | service/test/support/integration/app_test_client.py | 6 | ||||
-rw-r--r-- | service/test/support/integration/soledad_test_base.py | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/service/test/support/integration/app_test_client.py b/service/test/support/integration/app_test_client.py index d60d84dc..8d8d0d1f 100644 --- a/service/test/support/integration/app_test_client.py +++ b/service/test/support/integration/app_test_client.py @@ -37,6 +37,7 @@ from twisted.internet import reactor from twisted.internet.defer import succeed from twisted.web.resource import getChildForRequest from twisted.web.server import Site +import uuid class AppTestClient: @@ -45,7 +46,10 @@ class AppTestClient: def __init__(self, soledad_test_folder='/tmp/soledad-test/test'): + soledad_test_folder = os.path.join(soledad_test_folder, str(uuid.uuid4())) self.soledad = initialize_soledad(tempdir=soledad_test_folder) + self.cleanup = lambda: shutil.rmtree(soledad_test_folder) + self.mail_address = "test@pixelated.org" # setup app @@ -65,7 +69,7 @@ class AppTestClient: self.draft_service = DraftService(self.mailboxes) self.mail_service = MailService(self.mailboxes, self.mail_sender, self.tag_service, self.soledad_querier) - self.search_engine = SearchEngine(self.soledad_querier) + self.search_engine = SearchEngine(self.soledad_querier, agent_home=soledad_test_folder) self.search_engine.index_mails(self.mail_service.all_mails()) self.app.resource = RootResource() diff --git a/service/test/support/integration/soledad_test_base.py b/service/test/support/integration/soledad_test_base.py index eea510b9..60b88768 100644 --- a/service/test/support/integration/soledad_test_base.py +++ b/service/test/support/integration/soledad_test_base.py @@ -27,6 +27,9 @@ class SoledadTestBase(unittest.TestCase): def setUp(self): self.client = AppTestClient() + def tearDown(self): + self.client.cleanup() + def get_mails_by_tag(self, tag, page=1, window=100): tags = 'tag:%s' % tag return self.search(tags, page, window) |