diff --git a/common/djangoapps/terrain/browser.py b/common/djangoapps/terrain/browser.py index ffad1f7fb8..287d8917b3 100644 --- a/common/djangoapps/terrain/browser.py +++ b/common/djangoapps/terrain/browser.py @@ -279,10 +279,9 @@ def after_each_step(step): @after.harvest -def teardown_browser(total): +def saucelabs_status(total): """ - Quit the browser after executing the tests. + Collect data for saucelabs. """ if world.LETTUCE_SELENIUM_CLIENT == 'saucelabs': set_saucelabs_job_status(world.jobid, total.scenarios_ran == total.scenarios_passed) - world.browser.quit() diff --git a/common/djangoapps/terrain/setup_prereqs.py b/common/djangoapps/terrain/setup_prereqs.py index 90386af90c..6cf01da920 100644 --- a/common/djangoapps/terrain/setup_prereqs.py +++ b/common/djangoapps/terrain/setup_prereqs.py @@ -56,12 +56,19 @@ def stop_video_server(_total): video_server.shutdown() -@before.each_scenario # pylint: disable=no-member -def process_requires_tags(scenario): +@before.all +def start_stub_servers(): + """ + Start all stub servers + """ + + for stub in SERVICES.keys(): + start_stub(stub) + + +@before.each_scenario # pylint: disable=no-member +def skip_youtube_if_not_available(scenario): """ - Process the scenario tags to make sure that any - requirements are met prior to that scenario - being executed. Scenario tags must be named with this convention: @requires_stub_bar, where 'bar' is the name of the stub service to start @@ -85,7 +92,7 @@ def process_requires_tags(scenario): scenario.steps = [] return - start_stub(requires.group('server')) + return def start_stub(name): @@ -124,11 +131,13 @@ def is_youtube_available(urls): return True -@after.each_scenario # pylint: disable=no-member +@after.all # pylint: disable=no-member def stop_stubs(_scenario): """ - Shut down any stub services that were started up for the scenario. + Shut down any stub services. """ + # close browser to ensure no open connections to the stub servers + world.browser.quit() for name in SERVICES.keys(): stub_server = getattr(world, name, None) if stub_server is not None: