From ef89c75b192aad4752850d30d8bbfad01098990a Mon Sep 17 00:00:00 2001 From: Calen Pennington Date: Wed, 22 Jun 2016 16:34:24 -0400 Subject: [PATCH] Deprecate paver arguments with '_' in them in favor of versions with '-' --- .../course_structure_api/v0/tests.py | 2 +- pavelib/acceptance_test.py | 3 +- pavelib/bok_choy.py | 37 +++++++++++++----- pavelib/js_test.py | 3 +- pavelib/servers.py | 19 ++++++--- pavelib/tests.py | 39 ++++++++++++------- pavelib/utils/test/suites/nose_suite.py | 2 +- pavelib/utils/test/utils.py | 5 ++- scripts/accessibility-tests.sh | 2 +- scripts/circle-ci-tests.sh | 12 +++--- scripts/generic-ci-tests.sh | 10 ++--- 11 files changed, 88 insertions(+), 46 deletions(-) diff --git a/lms/djangoapps/course_structure_api/v0/tests.py b/lms/djangoapps/course_structure_api/v0/tests.py index 954c9beb45..a83baaee27 100644 --- a/lms/djangoapps/course_structure_api/v0/tests.py +++ b/lms/djangoapps/course_structure_api/v0/tests.py @@ -1,6 +1,6 @@ """ Run these tests @ Devstack: - paver test_system -s lms --fasttest --verbose --test_id=lms/djangoapps/course_structure_api + paver test_system -s lms --fasttest --verbose --test-id=lms/djangoapps/course_structure_api """ # pylint: disable=missing-docstring,invalid-name,maybe-no-member,attribute-defined-outside-init from datetime import datetime diff --git a/pavelib/acceptance_test.py b/pavelib/acceptance_test.py index 6d91d9d18f..e5fc548053 100644 --- a/pavelib/acceptance_test.py +++ b/pavelib/acceptance_test.py @@ -20,12 +20,13 @@ __test__ = False # do not collect ) @cmdopts([ ("system=", "s", "System to act on"), - ("default_store=", "m", "Default modulestore to use for course creation"), + ("default-store=", "m", "Default modulestore to use for course creation"), ("fasttest", "a", "Run without collectstatic"), make_option("--verbose", action="store_const", const=2, dest="verbosity"), make_option("-q", "--quiet", action="store_const", const=0, dest="verbosity"), make_option("-v", "--verbosity", action="count", dest="verbosity"), make_option("--pdb", action="store_true", help="Launches an interactive debugger upon error"), + ("default_store=", None, "deprecated in favor of default-store"), ('extra_args=', 'e', 'deprecated, pass extra options directly in the paver commandline'), ]) @PassthroughTask diff --git a/pavelib/bok_choy.py b/pavelib/bok_choy.py index 23d752173c..7d663f9e7a 100644 --- a/pavelib/bok_choy.py +++ b/pavelib/bok_choy.py @@ -18,23 +18,42 @@ except ImportError: __test__ = False # do not collect BOKCHOY_OPTS = [ - ('test_spec=', 't', 'Specific test to run'), + ('test-spec=', 't', 'Specific test to run'), ('fasttest', 'a', 'Skip some setup'), - ('skip_clean', 'C', 'Skip cleaning repository before running tests'), + ('skip-clean', 'C', 'Skip cleaning repository before running tests'), ('serversonly', 'r', 'Prepare suite and leave servers running'), ('testsonly', 'o', 'Assume servers are running and execute tests only'), - ('default_store=', 's', 'Default modulestore'), - ('test_dir=', 'd', 'Directory for finding tests (relative to common/test/acceptance)'), - ('imports_dir=', 'i', 'Directory containing (un-archived) courses to be imported'), - ('num_processes=', 'n', 'Number of test threads (for multiprocessing)'), - ('verify_xss', 'x', 'Run XSS vulnerability tests'), + ('default-store=', 's', 'Default modulestore'), + ('test-dir=', 'd', 'Directory for finding tests (relative to common/test/acceptance)'), + ('imports-dir=', 'i', 'Directory containing (un-archived) courses to be imported'), + ('num-processes=', 'n', 'Number of test threads (for multiprocessing)'), + ('verify-xss', 'x', 'Run XSS vulnerability tests'), make_option("--verbose", action="store_const", const=2, dest="verbosity"), make_option("-q", "--quiet", action="store_const", const=0, dest="verbosity"), make_option("-v", "--verbosity", action="count", dest="verbosity"), make_option("--pdb", action="store_true", help="Drop into debugger on failures or errors"), - make_option("--skip_firefox_version_validation", action='store_false', dest="validate_firefox_version"), - make_option("--save_screenshots", action='store_true', dest="save_screenshots"), + make_option("--skip-firefox-version-validation", action='store_false', dest="validate_firefox_version"), + make_option("--save-screenshots", action='store_true', dest="save_screenshots"), + ('default_store=', None, 'deprecated in favor of default-store'), ('extra_args=', 'e', 'deprecated, pass extra options directly in the paver commandline'), + ('imports_dir=', None, 'deprecated in favor of imports-dir'), + ('num_processes=', None, 'deprecated in favor of num-processes'), + ('skip_clean', None, 'deprecated in favor of skip-clean'), + ('test_dir=', None, 'deprecated in favor of test-dir'), + ('test_spec=', None, 'Specific test to run'), + ('verify_xss', None, 'deprecated in favor of verify-xss'), + make_option( + "--skip_firefox_version_validation", + action='store_false', + dest="validate_firefox_version", + help="deprecated in favor of --skip-firefox-version-validation" + ), + make_option( + "--save_screenshots", + action='store_true', + dest="save_screenshots", + help="deprecated in favor of save-screenshots" + ), ] diff --git a/pavelib/js_test.py b/pavelib/js_test.py index fb1a8933e6..058ffebe83 100644 --- a/pavelib/js_test.py +++ b/pavelib/js_test.py @@ -19,7 +19,8 @@ __test__ = False # do not collect ("mode=", "m", "dev or run"), ("coverage", "c", "Run test under coverage"), ("port=", "p", "Port to run test server on (dev mode only)"), - ('skip_clean', 'C', 'skip cleaning repository before running tests'), + ('skip-clean', 'C', 'skip cleaning repository before running tests'), + ('skip_clean', None, 'deprecated in favor of skip-clean'), ], share_with=["pavelib.utils.tests.utils.clean_reports_dir"]) def test_js(options): """ diff --git a/pavelib/servers.py b/pavelib/servers.py index 19d9302409..db4076ccf6 100644 --- a/pavelib/servers.py +++ b/pavelib/servers.py @@ -164,14 +164,21 @@ def celery(options): @needs('pavelib.prereqs.install_prereqs') @cmdopts([ ("settings=", "s", "Django settings for both LMS and Studio"), - ("asset_settings=", "a", "Django settings for updating assets for both LMS and Studio (defaults to settings)"), - ("worker_settings=", "w", "Celery worker Django settings"), + ("asset-settings=", "a", "Django settings for updating assets for both LMS and Studio (defaults to settings)"), + ("worker-settings=", "w", "Celery worker Django settings"), ("fast", "f", "Skip updating assets"), ("optimized", "o", "Run with optimized assets"), - ("settings_lms=", "l", "Set LMS only, overriding the value from --settings (if provided)"), - ("asset_settings_lms=", None, "Set LMS only, overriding the value from --asset_settings (if provided)"), - ("settings_cms=", "c", "Set Studio only, overriding the value from --settings (if provided)"), - ("asset_settings_cms=", None, "Set Studio only, overriding the value from --asset_settings (if provided)"), + ("settings-lms=", "l", "Set LMS only, overriding the value from --settings (if provided)"), + ("asset-settings-lms=", None, "Set LMS only, overriding the value from --asset-settings (if provided)"), + ("settings-cms=", "c", "Set Studio only, overriding the value from --settings (if provided)"), + ("asset-settings-cms=", None, "Set Studio only, overriding the value from --asset-settings (if provided)"), + + ("asset_settings=", None, "deprecated in favor of asset-settings"), + ("asset_settings_cms=", None, "deprecated in favor of asset-settings-cms"), + ("asset_settings_lms=", None, "deprecated in favor of asset-settings-lms"), + ("settings_cms=", None, "deprecated in favor of settings-cms"), + ("settings_lms=", None, "deprecated in favor of settings-lms"), + ("worker_settings=", None, "deprecated in favor of worker-settings"), ]) def run_all_servers(options): """ diff --git a/pavelib/tests.py b/pavelib/tests.py index a34a43a3dd..f3a8861003 100644 --- a/pavelib/tests.py +++ b/pavelib/tests.py @@ -24,12 +24,12 @@ __test__ = False # do not collect ) @cmdopts([ ("system=", "s", "System to act on"), - ("test_id=", "t", "Test id"), + ("test-id=", "t", "Test id"), ("failed", "f", "Run only failed tests"), - ("fail_fast", "x", "Fail suite on first failed test"), + ("fail-fast", "x", "Fail suite on first failed test"), ("fasttest", "a", "Run without collectstatic"), - ('cov_args=', 'c', 'adds as args to coverage for the test run'), - ('skip_clean', 'C', 'skip cleaning repository before running tests'), + ('cov-args=', 'c', 'adds as args to coverage for the test run'), + ('skip-clean', 'C', 'skip cleaning repository before running tests'), ('processes=', 'p', 'number of processes to use running tests'), make_option('-r', '--randomize', action='store_true', dest='randomize', help='run the tests in a random order'), make_option('--no-randomize', action='store_false', dest='randomize', help="don't run the tests in a random order"), @@ -43,7 +43,11 @@ __test__ = False # do not collect dest='disable_migrations', help="Create tables directly from apps' models. Can also be used by exporting DISABLE_MIGRATIONS=1." ), + ("fail_fast", None, "deprecated in favor of fail-fast"), + ("test_id=", None, "deprecated in favor of test-id"), + ('cov_args=', None, 'deprecated in favor of cov-args'), ('extra_args=', 'e', 'deprecated, pass extra options directly in the paver commandline'), + ('skip_clean', None, 'deprecated in favor of skip-clean'), ], share_with=['pavelib.utils.test.utils.clean_reports_dir']) @PassthroughTask def test_system(options, passthrough_options): @@ -92,16 +96,20 @@ def test_system(options, passthrough_options): ) @cmdopts([ ("lib=", "l", "lib to test"), - ("test_id=", "t", "Test id"), + ("test-id=", "t", "Test id"), ("failed", "f", "Run only failed tests"), - ("fail_fast", "x", "Run only failed tests"), - ('cov_args=', 'c', 'adds as args to coverage for the test run'), - ('skip_clean', 'C', 'skip cleaning repository before running tests'), + ("fail-fast", "x", "Run only failed tests"), + ('cov-args=', 'c', 'adds as args to coverage for the test run'), + ('skip-clean', 'C', 'skip cleaning repository before running tests'), make_option("--verbose", action="store_const", const=2, dest="verbosity"), make_option("-q", "--quiet", action="store_const", const=0, dest="verbosity"), make_option("-v", "--verbosity", action="count", dest="verbosity", default=1), make_option("--pdb", action="store_true", help="Drop into debugger on failures or errors"), + ('cov_args=', None, 'deprecated in favor of cov-args'), ('extra_args=', 'e', 'deprecated, pass extra options directly in the paver commandline'), + ("fail_fast", None, "deprecated in favor of fail-fast"), + ('skip_clean', None, 'deprecated in favor of skip-clean'), + ("test_id=", None, "deprecated in favor of test-id"), ], share_with=['pavelib.utils.test.utils.clean_reports_dir']) @PassthroughTask def test_lib(options, passthrough_options): @@ -142,8 +150,8 @@ def test_lib(options, passthrough_options): ) @cmdopts([ ("failed", "f", "Run only failed tests"), - ("fail_fast", "x", "Run only failed tests"), - ('cov_args=', 'c', 'adds as args to coverage for the test run'), + ("fail-fast", "x", "Run only failed tests"), + ('cov-args=', 'c', 'adds as args to coverage for the test run'), make_option("--verbose", action="store_const", const=2, dest="verbosity"), make_option("-q", "--quiet", action="store_const", const=0, dest="verbosity"), make_option("-v", "--verbosity", action="count", dest="verbosity", default=1), @@ -154,7 +162,9 @@ def test_lib(options, passthrough_options): dest='disable_migrations', help="Create tables directly from apps' models. Can also be used by exporting DISABLE_MIGRATIONS=1." ), + ('cov_args=', None, 'deprecated in favor of cov-args'), ('extra_args=', 'e', 'deprecated, pass extra options directly in the paver commandline'), + ("fail_fast", None, "deprecated in favor of fail-fast"), ]) @PassthroughTask def test_python(options, passthrough_options): @@ -182,11 +192,12 @@ def test_python(options, passthrough_options): ) @cmdopts([ ("suites", "s", "List of unit test suites to run. (js, lib, cms, lms)"), - ('cov_args=', 'c', 'adds as args to coverage for the test run'), + ('cov-args=', 'c', 'adds as args to coverage for the test run'), make_option("--verbose", action="store_const", const=2, dest="verbosity"), make_option("-q", "--quiet", action="store_const", const=0, dest="verbosity"), make_option("-v", "--verbosity", action="count", dest="verbosity", default=1), make_option("--pdb", action="store_true", help="Drop into debugger on failures or errors"), + ('cov_args=', None, 'deprecated in favor of cov-args'), ('extra_args=', 'e', 'deprecated, pass extra options directly in the paver commandline'), ]) @PassthroughTask @@ -213,7 +224,8 @@ def test(options, passthrough_options): @task @needs('pavelib.prereqs.install_prereqs') @cmdopts([ - ("compare_branch=", "b", "Branch to compare against, defaults to origin/master"), + ("compare-branch=", "b", "Branch to compare against, defaults to origin/master"), + ("compare_branch=", None, "deprecated in favor of compare-branch"), ]) def coverage(options): """ @@ -249,7 +261,8 @@ def coverage(options): @task @needs('pavelib.prereqs.install_prereqs') @cmdopts([ - ("compare_branch=", "b", "Branch to compare against, defaults to origin/master"), + ("compare-branch=", "b", "Branch to compare against, defaults to origin/master"), + ("compare_branch=", None, "deprecated in favor of compare-branch"), ]) def diff_coverage(options): """ diff --git a/pavelib/utils/test/suites/nose_suite.py b/pavelib/utils/test/suites/nose_suite.py index a199191096..89c114d621 100644 --- a/pavelib/utils/test/suites/nose_suite.py +++ b/pavelib/utils/test/suites/nose_suite.py @@ -95,7 +95,7 @@ class NoseTestSuite(TestSuite): opts += "--failed" # This makes it so we use nose's fail-fast feature in two cases. - # Case 1: --fail_fast is passed as an arg in the paver command + # Case 1: --fail-fast is passed as an arg in the paver command # Case 2: The environment variable TESTS_FAIL_FAST is set as True env_fail_fast_set = ( 'TESTS_FAIL_FAST' in os.environ and os.environ['TEST_FAIL_FAST'] diff --git a/pavelib/utils/test/utils.py b/pavelib/utils/test/utils.py index 8e3e3e62b1..769fe17386 100644 --- a/pavelib/utils/test/utils.py +++ b/pavelib/utils/test/utils.py @@ -39,14 +39,15 @@ def clean_dir(directory): @task @cmdopts([ - ('skip_clean', 'C', 'skip cleaning repository before running tests'), + ('skip-clean', 'C', 'skip cleaning repository before running tests'), + ('skip_clean', None, 'deprecated in favor of skip-clean'), ]) def clean_reports_dir(options): """ Clean coverage files, to ensure that we don't use stale data to generate reports. """ if getattr(options, 'skip_clean', False): - print '--skip_clean is set, skipping...' + print '--skip-clean is set, skipping...' return # We delete the files but preserve the directory structure diff --git a/scripts/accessibility-tests.sh b/scripts/accessibility-tests.sh index d9ec4d250d..3730215bb2 100755 --- a/scripts/accessibility-tests.sh +++ b/scripts/accessibility-tests.sh @@ -24,7 +24,7 @@ paver a11y_coverage if [ "$RUN_PA11YCRAWLER" = "1" ] then echo "Running pa11ycrawler against test course..." - paver pa11ycrawler --fasttest --skip_clean --fetch-course --with-html + paver pa11ycrawler --fasttest --skip-clean --fetch-course --with-html echo "Generating coverage report..." paver pa11ycrawler_coverage diff --git a/scripts/circle-ci-tests.sh b/scripts/circle-ci-tests.sh index e2243f4798..11c05239a3 100755 --- a/scripts/circle-ci-tests.sh +++ b/scripts/circle-ci-tests.sh @@ -37,11 +37,11 @@ if [ "$CIRCLE_NODE_TOTAL" == "1" ] ; then echo "via the CircleCI UI and adjust scripts/circle-ci-tests.sh to match." echo "Running tests for common/lib/ and pavelib/" - paver test_lib --with-flaky --cov_args="-p" || EXIT=1 + paver test_lib --with-flaky --cov-args="-p" || EXIT=1 echo "Running python tests for Studio" - paver test_system -s cms --with-flaky --cov_args="-p" || EXIT=1 + paver test_system -s cms --with-flaky --cov-args="-p" || EXIT=1 echo "Running python tests for lms" - paver test_system -s lms --with-flaky --cov_args="-p" || EXIT=1 + paver test_system -s lms --with-flaky --cov-args="-p" || EXIT=1 exit $EXIT else @@ -74,15 +74,15 @@ else ;; 1) # run all of the lms unit tests - paver test_system -s lms --with-flaky --cov_args="-p" + paver test_system -s lms --with-flaky --cov-args="-p" ;; 2) # run all of the cms unit tests - paver test_system -s cms --with-flaky --cov_args="-p" + paver test_system -s cms --with-flaky --cov-args="-p" ;; 3) # run the commonlib unit tests - paver test_lib --with-flaky --cov_args="-p" + paver test_lib --with-flaky --cov-args="-p" ;; *) diff --git a/scripts/generic-ci-tests.sh b/scripts/generic-ci-tests.sh index 06642d3b27..363a851e0f 100755 --- a/scripts/generic-ci-tests.sh +++ b/scripts/generic-ci-tests.sh @@ -99,7 +99,7 @@ case "$TEST_SUITE" in ;; "lms-unit") - PAVER_ARGS="--with-flaky --processes=-1 --cov_args='-p' -v" + PAVER_ARGS="--with-flaky --processes=-1 --cov-args='-p' -v" case "$SHARD" in "all") paver test_system -s lms $PAVER_ARGS @@ -128,11 +128,11 @@ case "$TEST_SUITE" in ;; "cms-unit") - paver test_system -s cms --with-flaky --cov_args="-p" -v + paver test_system -s cms --with-flaky --cov-args="-p" -v ;; "commonlib-unit") - paver test_lib --with-flaky --cov_args="-p" -v + paver test_lib --with-flaky --cov-args="-p" -v ;; "js-unit") @@ -141,8 +141,8 @@ case "$TEST_SUITE" in ;; "commonlib-js-unit") - paver test_js --coverage --skip_clean || { EXIT=1; } - paver test_lib --skip_clean --with-flaky --cov_args="-p" || { EXIT=1; } + paver test_js --coverage --skip-clean || { EXIT=1; } + paver test_lib --skip-clean --with-flaky --cov-args="-p" || { EXIT=1; } # This is to ensure that the build status of the shard is properly set. # Because we are running two paver commands in a row, we need to capture