def __enter__(self): super(BokChoyTestSuite, self).__enter__() # Ensure that we have a directory to put logs and reports self.log_dir.makedirs_p() self.har_dir.makedirs_p() self.report_dir.makedirs_p() test_utils.clean_reports_dir() if not (self.fasttest or self.skip_clean): test_utils.clean_test_files() msg = colorize('green', "Checking for mongo, memchache, and mysql...") print msg bokchoy_utils.check_services() if not self.testsonly: self.prepare_bokchoy_run() msg = colorize('green', "Confirming servers have started...") print msg bokchoy_utils.wait_for_test_servers() try: # Create course in order to seed forum data underneath. This is # a workaround for a race condition. The first time a course is created; # role permissions are set up for forums. CourseFixture('foobar_org', '1117', 'seed_forum', 'seed_foo').install() print 'Forums permissions/roles data has been seeded' except FixtureError: # this means it's already been done pass if self.serversonly: self.run_servers_continuously()
def __enter__(self): super(BokChoyTestSuite, self).__enter__() # Ensure that we have a directory to put logs and reports self.log_dir.makedirs_p() self.report_dir.makedirs_p() test_utils.clean_reports_dir() msg = colorize("green", "Checking for mongo, memchache, and mysql...") print(msg) bokchoy_utils.check_services() if not self.fasttest: # Process assets and set up database for bok-choy tests # Reset the database sh("{}/scripts/reset-test-db.sh".format(Env.REPO_ROOT)) # Collect static assets sh("paver update_assets --settings=bok_choy") # Clear any test data already in Mongo or MySQLand invalidate # the cache bokchoy_utils.clear_mongo() self.cache.flush_all() sh("./manage.py lms --settings bok_choy loaddata --traceback" " common/test/db_fixtures/*.json") # Ensure the test servers are available msg = colorize("green", "Starting test servers...") print(msg) bokchoy_utils.start_servers() msg = colorize("green", "Waiting for servers to start...") print(msg) bokchoy_utils.wait_for_test_servers()
def __enter__(self): super(BokChoyTestSuite, self).__enter__() # Ensure that we have a directory to put logs and reports self.log_dir.makedirs_p() self.har_dir.makedirs_p() self.report_dir.makedirs_p() test_utils.clean_reports_dir() if not self.skip_clean: test_utils.clean_test_files() msg = colorize('green', "Checking for mongo, memchache, and mysql...") print(msg) bokchoy_utils.check_services() sh("{}/scripts/reset-test-db.sh".format(Env.REPO_ROOT)) if not self.fasttest: # Process assets and set up database for bok-choy tests # Reset the database # Collect static assets sh("paver update_assets --settings=bok_choy") # Clear any test data already in Mongo or MySQLand invalidate # the cache bokchoy_utils.clear_mongo() self.cache.flush_all() sh( "DEFAULT_STORE={default_store}" " ./manage.py lms --settings bok_choy loaddata --traceback" " common/test/db_fixtures/*.json".format( default_store=self.default_store, ) ) if self.imports_dir: sh( "DEFAULT_STORE={default_store}" " ./manage.py cms --settings=bok_choy import {import_dir}".format( default_store=self.default_store, import_dir=self.imports_dir ) ) # Ensure the test servers are available msg = colorize('green', "Starting test servers...") print(msg) bokchoy_utils.start_servers(self.default_store) msg = colorize('green', "Waiting for servers to start...") print(msg) bokchoy_utils.wait_for_test_servers()
def __enter__(self): super().__enter__() # Ensure that we have a directory to put logs and reports self.log_dir.makedirs_p() self.har_dir.makedirs_p() self.report_dir.makedirs_p() test_utils.clean_reports_dir() # pylint: disable=no-value-for-parameter # Set the environment so that webpack understands where to compile its resources. # This setting is expected in other environments, so we are setting it for the # bok-choy test run. os.environ['EDX_PLATFORM_SETTINGS'] = 'test_static_optimized' if not (self.fasttest or self.skip_clean or self.testsonly): test_utils.clean_test_files() msg = colorize('green', "Checking for mongo, memchache, and mysql...") print(msg) check_services() if not self.testsonly: call_task('prepare_bokchoy_run', options={ 'log_dir': self.log_dir, 'coveragerc': self.coveragerc }) else: # load data in db_fixtures load_bok_choy_data() # pylint: disable=no-value-for-parameter update_fixtures() msg = colorize('green', "Confirming servers have started...") print(msg) wait_for_test_servers() try: # Create course in order to seed forum data underneath. This is # a workaround for a race condition. The first time a course is created; # role permissions are set up for forums. dry( "Installing course fixture for forums", CourseFixture('foobar_org', '1117', 'seed_forum', 'seed_foo').install) print('Forums permissions/roles data has been seeded') except FixtureError: # this means it's already been done pass if self.serversonly: self.run_servers_continuously()
def __enter__(self): super(BokChoyTestSuite, self).__enter__() # Ensure that we have a directory to put logs and reports self.log_dir.makedirs_p() self.har_dir.makedirs_p() self.report_dir.makedirs_p() test_utils.clean_reports_dir() # pylint: disable=no-value-for-parameter # Set the environment so that webpack understands where to compile its resources. # This setting is expected in other environments, so we are setting it for the # bok-choy test run. os.environ['EDX_PLATFORM_SETTINGS'] = 'test_static_optimized' if not (self.fasttest or self.skip_clean or self.testsonly): test_utils.clean_test_files() msg = colorize('green', "Checking for mongo, memchache, and mysql...") print msg check_services() if not self.testsonly: call_task('prepare_bokchoy_run', options={'log_dir': self.log_dir}) else: # load data in db_fixtures load_bok_choy_data() # pylint: disable=no-value-for-parameter update_fixtures() msg = colorize('green', "Confirming servers have started...") print msg wait_for_test_servers() try: # Create course in order to seed forum data underneath. This is # a workaround for a race condition. The first time a course is created; # role permissions are set up for forums. dry( "Installing course fixture for forums", CourseFixture('foobar_org', '1117', 'seed_forum', 'seed_foo').install ) print 'Forums permissions/roles data has been seeded' except FixtureError: # this means it's already been done pass if self.serversonly: self.run_servers_continuously()
def __enter__(self): super(BokChoyTestSuite, self).__enter__() # Ensure that we have a directory to put logs and reports self.log_dir.makedirs_p() self.har_dir.makedirs_p() self.report_dir.makedirs_p() test_utils.clean_reports_dir() if not (self.fasttest or self.skip_clean): test_utils.clean_test_files() msg = colorize('green', "Checking for mongo, memchache, and mysql...") print msg bokchoy_utils.check_services() if not self.testsonly: self.prepare_bokchoy_run() msg = colorize('green', "Confirming servers have started...") print msg bokchoy_utils.wait_for_test_servers() if self.serversonly: self.run_servers_continuously()
def __enter__(self): super(BokChoyTestSuite, self).__enter__() # Ensure that we have a directory to put logs and reports self.log_dir.makedirs_p() self.har_dir.makedirs_p() self.report_dir.makedirs_p() test_utils.clean_reports_dir() if not self.skip_clean: test_utils.clean_test_files() msg = colorize('green', "Checking for mongo, memchache, and mysql...") print msg bokchoy_utils.check_services() if not self.testsonly: self.prepare_bokchoy_run() msg = colorize('green', "Confirming servers have started...") print msg bokchoy_utils.wait_for_test_servers() if self.serversonly: self.run_servers_continuously()