From a6b55c2d17ccc1b7d61595aba2311ac09ed70030 Mon Sep 17 00:00:00 2001 From: Michael Youngstrom Date: Tue, 7 Nov 2017 10:54:21 -0500 Subject: [PATCH] Remove coverage reports for a11y and bokchoy tests by default --- pavelib/bok_choy.py | 5 +++-- pavelib/paver_tests/test_paver_bok_choy_cmds.py | 4 +--- pavelib/utils/test/bokchoy_options.py | 1 - pavelib/utils/test/bokchoy_utils.py | 13 +++++++------ pavelib/utils/test/suites/bokchoy_suite.py | 14 +++++++++----- scripts/accessibility-tests.sh | 6 ------ 6 files changed, 20 insertions(+), 23 deletions(-) diff --git a/pavelib/bok_choy.py b/pavelib/bok_choy.py index 2ea562f61e..f0d3d9cb6d 100644 --- a/pavelib/bok_choy.py +++ b/pavelib/bok_choy.py @@ -51,6 +51,7 @@ def test_bokchoy(options, passthrough_options): # firefox as the default here. using_firefox = (os.environ.get('SELENIUM_BROWSER', 'firefox') == 'firefox') validate_firefox = getattr(options, 'validate_firefox_version', using_firefox) + options.test_bokchoy.coveragerc = options.get('coveragerc', None) if validate_firefox: check_firefox_version() @@ -81,8 +82,8 @@ def test_a11y(options, passthrough_options): # Modify the options object directly, so that any subsequently called tasks # that share with this task get the modified options options.test_a11y.report_dir = Env.BOK_CHOY_A11Y_REPORT_DIR - options.test_a11y.coveragerc = Env.BOK_CHOY_A11Y_COVERAGERC options.test_a11y.extra_args = options.get('extra_args', '') + ' -a "a11y" ' + options.test_a11y.coveragerc = options.get('coveragerc', None) run_bokchoy(options.test_a11y, passthrough_options) @@ -120,7 +121,7 @@ def pa11ycrawler(options, passthrough_options): # Modify the options object directly, so that any subsequently called tasks # that share with this task get the modified options options.pa11ycrawler.report_dir = Env.PA11YCRAWLER_REPORT_DIR - options.pa11ycrawler.coveragerc = Env.PA11YCRAWLER_COVERAGERC + options.pa11ycrawler.coveragerc = options.get('coveragerc', None) options.pa11ycrawler.should_fetch_course = getattr( options, 'should_fetch_course', diff --git a/pavelib/paver_tests/test_paver_bok_choy_cmds.py b/pavelib/paver_tests/test_paver_bok_choy_cmds.py index 9a488cc97f..75e6ebc740 100644 --- a/pavelib/paver_tests/test_paver_bok_choy_cmds.py +++ b/pavelib/paver_tests/test_paver_bok_choy_cmds.py @@ -41,9 +41,7 @@ class TestPaverBokChoyCmd(unittest.TestCase): ), "SELENIUM_DRIVER_LOG_DIR='{}/test_root/log{}'".format(REPO_DIR, shard_str), "VERIFY_XSS='{}'".format(verify_xss), - "coverage", - "run", - "--rcfile={}".format(Env.BOK_CHOY_COVERAGERC), + "python", "-m", "pytest", "{}/common/test/acceptance/{}".format(REPO_DIR, name), diff --git a/pavelib/utils/test/bokchoy_options.py b/pavelib/utils/test/bokchoy_options.py index 48ec319a94..272251daf1 100644 --- a/pavelib/utils/test/bokchoy_options.py +++ b/pavelib/utils/test/bokchoy_options.py @@ -26,7 +26,6 @@ BOKCHOY_EVAL_ATTR = make_option( BOKCHOY_FASTTEST = make_option('--fasttest', action='store_true', help='Skip some setup') BOKCHOY_COVERAGERC = make_option( '--coveragerc', - default=Env.BOK_CHOY_COVERAGERC, help='coveragerc file to use during this test' ) diff --git a/pavelib/utils/test/bokchoy_utils.py b/pavelib/utils/test/bokchoy_utils.py index c8198d673b..0cd5015e58 100644 --- a/pavelib/utils/test/bokchoy_utils.py +++ b/pavelib/utils/test/bokchoy_utils.py @@ -30,7 +30,7 @@ def start_servers(options): """ Start the servers we will run tests on, returns PIDs for servers. """ - coveragerc = options.get('coveragerc', Env.BOK_CHOY_COVERAGERC) + coveragerc = options.get('coveragerc', None) def start_server(cmd, logfile, cwd=None): """ @@ -41,13 +41,14 @@ def start_servers(options): for service, info in Env.BOK_CHOY_SERVERS.iteritems(): address = "0.0.0.0:{}".format(info['port']) - cmd = ( - "DEFAULT_STORE={default_store} " - "coverage run --rcfile={coveragerc} -m " + cmd = ("DEFAULT_STORE={default_store} ").format(default_store=options.default_store) + if coveragerc: + cmd += ("coverage run --rcfile={coveragerc} -m ").format(coveragerc=coveragerc) + else: + cmd += "python -m " + cmd += ( "manage {service} --settings {settings} runserver " "{address} --traceback --noreload".format( - default_store=options.default_store, - coveragerc=coveragerc, service=service, settings=Env.SETTINGS, address=address, diff --git a/pavelib/utils/test/suites/bokchoy_suite.py b/pavelib/utils/test/suites/bokchoy_suite.py index e04bcc0d1c..e120159a80 100644 --- a/pavelib/utils/test/suites/bokchoy_suite.py +++ b/pavelib/utils/test/suites/bokchoy_suite.py @@ -205,7 +205,7 @@ class BokChoyTestSuite(TestSuite): self.har_dir = self.log_dir / 'hars' self.a11y_file = Env.BOK_CHOY_A11Y_CUSTOM_RULES_FILE self.imports_dir = kwargs.get('imports_dir', None) - self.coveragerc = kwargs.get('coveragerc', Env.BOK_CHOY_COVERAGERC) + self.coveragerc = kwargs.get('coveragerc', None) self.save_screenshots = kwargs.get('save_screenshots', False) def __enter__(self): @@ -333,12 +333,16 @@ class BokChoyTestSuite(TestSuite): ] if self.save_screenshots: cmd.append("NEEDLE_SAVE_BASELINE=True") - cmd += [ - "coverage", - "run", - ] if self.coveragerc: + cmd += [ + "coverage", + "run", + ] cmd.append("--rcfile={}".format(self.coveragerc)) + else: + cmd += [ + "python" + ] cmd += [ "-m", "pytest", diff --git a/scripts/accessibility-tests.sh b/scripts/accessibility-tests.sh index 41dbb8e0ca..60e0e2c567 100755 --- a/scripts/accessibility-tests.sh +++ b/scripts/accessibility-tests.sh @@ -8,14 +8,8 @@ source scripts/jenkins-common.sh echo "Running explicit accessibility tests..." SELENIUM_BROWSER=phantomjs paver test_a11y -echo "Generating coverage report..." -paver a11y_coverage - # The settings that we use are installed with the pa11ycrawler module export SCRAPY_SETTINGS_MODULE='pa11ycrawler.settings' echo "Running pa11ycrawler against test course..." paver pa11ycrawler --fasttest --skip-clean --fetch-course --with-html - -echo "Generating pa11ycrawler coverage report..." -paver pa11ycrawler_coverage