From b0d70008e4dfba63a478966184c9f3a3b9522e01 Mon Sep 17 00:00:00 2001 From: JonahStanley Date: Fri, 28 Jun 2013 09:52:23 -0400 Subject: [PATCH] Changed when the databases are reset This might allow parallel features in the future --- cms/envs/acceptance.py | 1 + common/djangoapps/terrain/browser.py | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/cms/envs/acceptance.py b/cms/envs/acceptance.py index 4b27c2a24f..40d5894378 100644 --- a/cms/envs/acceptance.py +++ b/cms/envs/acceptance.py @@ -16,6 +16,7 @@ DEBUG = True # Disable warnings for acceptance tests, to make the logs readable import logging logging.disable(logging.ERROR) +from uuid import uuid4 MODULESTORE_OPTIONS = { 'default_class': 'xmodule.raw_module.RawDescriptor', diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index 6b2114d8cc..94f63f6543 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -19,6 +19,7 @@ from lms import one_time_startup # pylint: disable=W0611 from cms import one_time_startup # pylint: disable=W0611 from pymongo import MongoClient import xmodule.modulestore.django +from xmodule.contentstore.django import _CONTENTSTORE # There is an import issue when using django-staticfiles with lettuce # Lettuce assumes that we are using django.contrib.staticfiles, @@ -89,6 +90,17 @@ def reset_data(scenario): LOGGER.debug("Flushing the test database...") call_command('flush', interactive=False) + +@after.each_scenario +def reset_databases(scenario): + mongo = MongoClient() + mongo.drop_database(settings.CONTENTSTORE['OPTIONS']['db']) + _CONTENTSTORE.clear() + modulestore = xmodule.modulestore.django.modulestore() + modulestore.collection.drop() + xmodule.modulestore.django._MODULESTORES.clear() + + # Uncomment below to trigger a screenshot on error # @after.each_scenario def screenshot_on_error(scenario): @@ -105,7 +117,3 @@ def teardown_browser(total): Quit the browser after executing the tests. """ world.browser.quit() - mongo = MongoClient() - mongo.drop_database(settings.CONTENTSTORE['OPTIONS']['db']) - modulestore = xmodule.modulestore.django.modulestore() - modulestore.collection.drop()