Commit fa525732 by Calen Pennington

Move the definition of shared bok_choy task options into a separate file

parent f94530ba
...@@ -4,6 +4,7 @@ http://bok-choy.readthedocs.org/en/latest/ ...@@ -4,6 +4,7 @@ http://bok-choy.readthedocs.org/en/latest/
""" """
from paver.easy import task, needs, cmdopts, sh from paver.easy import task, needs, cmdopts, sh
from pavelib.utils.test.suites.bokchoy_suite import BokChoyTestSuite, Pa11yCrawler from pavelib.utils.test.suites.bokchoy_suite import BokChoyTestSuite, Pa11yCrawler
from pavelib.utils.test.bokchoy_options import BOKCHOY_OPTS, parse_bokchoy_opts
from pavelib.utils.envs import Env from pavelib.utils.envs import Env
from pavelib.utils.test.utils import check_firefox_version from pavelib.utils.test.utils import check_firefox_version
from pavelib.utils.passthrough_opts import PassthroughTask from pavelib.utils.passthrough_opts import PassthroughTask
...@@ -18,71 +19,6 @@ except ImportError: ...@@ -18,71 +19,6 @@ except ImportError:
__test__ = False # do not collect __test__ = False # do not collect
BOKCHOY_OPTS = [
('test-spec=', 't', 'Specific test to run'),
('fasttest', 'a', 'Skip some setup'),
('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'),
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("--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"
),
]
def parse_bokchoy_opts(options, passthrough_options=None):
"""
Parses bok choy options.
Returns: dict of options.
"""
if passthrough_options is None:
passthrough_options = []
return {
'test_spec': getattr(options, 'test_spec', None),
'fasttest': getattr(options, 'fasttest', False),
'num_processes': int(getattr(options, 'num_processes', 1)),
'verify_xss': getattr(options, 'verify_xss', os.environ.get('VERIFY_XSS', False)),
'serversonly': getattr(options, 'serversonly', False),
'testsonly': getattr(options, 'testsonly', False),
'default_store': getattr(options, 'default_store', os.environ.get('DEFAULT_STORE', 'split')),
'verbosity': getattr(options, 'verbosity', 2),
'extra_args': getattr(options, 'extra_args', ''),
'pdb': getattr(options, 'pdb', False),
'test_dir': getattr(options, 'test_dir', 'tests'),
'imports_dir': getattr(options, 'imports_dir', None),
'save_screenshots': getattr(options, 'save_screenshots', False),
'passthrough_options': passthrough_options
}
@needs('pavelib.prereqs.install_prereqs') @needs('pavelib.prereqs.install_prereqs')
@cmdopts(BOKCHOY_OPTS) @cmdopts(BOKCHOY_OPTS)
......
from optparse import make_option
import os
BOKCHOY_OPTS = [
('test-spec=', 't', 'Specific test to run'),
('fasttest', 'a', 'Skip some setup'),
('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'),
make_option("-s", "--default-store", default=os.environ.get('DEFAULT_STORE', 'split'), help='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("--skip-firefox-version-validation", action='store_false', dest="validate_firefox_version"),
make_option("--save-screenshots", action='store_true', dest="save_screenshots"),
make_option("--default_store", default=os.environ.get('DEFAULT_STORE', 'split'), help='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"
),
]
def parse_bokchoy_opts(options, passthrough_options=None):
"""
Parses bok choy options.
Returns: dict of options.
"""
if passthrough_options is None:
passthrough_options = []
return {
'test_spec': getattr(options, 'test_spec', None),
'fasttest': getattr(options, 'fasttest', False),
'num_processes': int(getattr(options, 'num_processes', 1)),
'verify_xss': getattr(options, 'verify_xss', os.environ.get('VERIFY_XSS', False)),
'serversonly': getattr(options, 'serversonly', False),
'testsonly': getattr(options, 'testsonly', False),
'default_store': getattr(options, 'default_store', os.environ.get('DEFAULT_STORE', 'split')),
'verbosity': getattr(options, 'verbosity', 2),
'extra_args': getattr(options, 'extra_args', ''),
'pdb': getattr(options, 'pdb', False),
'test_dir': getattr(options, 'test_dir', 'tests'),
'imports_dir': getattr(options, 'imports_dir', None),
'save_screenshots': getattr(options, 'save_screenshots', False),
'passthrough_options': passthrough_options
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment