Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
1f17fe12
Commit
1f17fe12
authored
Jan 28, 2015
by
Christine Lytwynec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add cov_args and extra_args to python unittest commands
parent
dce62ed6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
pavelib/tests.py
+12
-0
pavelib/utils/test/suites/nose_suite.py
+8
-3
No files found.
pavelib/tests.py
View file @
1f17fe12
...
...
@@ -27,6 +27,8 @@ __test__ = False # do not collect
(
"failed"
,
"f"
,
"Run only failed tests"
),
(
"fail_fast"
,
"x"
,
"Run only failed tests"
),
(
"fasttest"
,
"a"
,
"Run without collectstatic"
),
(
'extra_args='
,
'e'
,
'adds as extra args to the test command'
),
(
'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
),
...
...
@@ -43,6 +45,8 @@ def test_system(options):
'fail_fast'
:
getattr
(
options
,
'fail_fast'
,
None
),
'fasttest'
:
getattr
(
options
,
'fasttest'
,
None
),
'verbosity'
:
getattr
(
options
,
'verbosity'
,
1
),
'extra_args'
:
getattr
(
options
,
'extra_args'
,
''
),
'cov_args'
:
getattr
(
options
,
'cov_args'
,
''
),
}
if
test_id
:
...
...
@@ -73,6 +77,8 @@ def test_system(options):
(
"test_id="
,
"t"
,
"Test id"
),
(
"failed"
,
"f"
,
"Run only failed tests"
),
(
"fail_fast"
,
"x"
,
"Run only failed tests"
),
(
'extra_args='
,
'e'
,
'adds as extra args to the test command'
),
(
'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
),
...
...
@@ -88,6 +94,8 @@ def test_lib(options):
'failed_only'
:
getattr
(
options
,
'failed'
,
None
),
'fail_fast'
:
getattr
(
options
,
'fail_fast'
,
None
),
'verbosity'
:
getattr
(
options
,
'verbosity'
,
1
),
'extra_args'
:
getattr
(
options
,
'extra_args'
,
''
),
'cov_args'
:
getattr
(
options
,
'cov_args'
,
''
),
}
if
test_id
:
...
...
@@ -115,6 +123,8 @@ def test_lib(options):
@cmdopts
([
(
"failed"
,
"f"
,
"Run only failed tests"
),
(
"fail_fast"
,
"x"
,
"Run only failed tests"
),
(
'extra_args='
,
'e'
,
'adds as extra args to the test command'
),
(
'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
),
...
...
@@ -127,6 +137,8 @@ def test_python(options):
'failed_only'
:
getattr
(
options
,
'failed'
,
None
),
'fail_fast'
:
getattr
(
options
,
'fail_fast'
,
None
),
'verbosity'
:
getattr
(
options
,
'verbosity'
,
1
),
'extra_args'
:
getattr
(
options
,
'extra_args'
,
''
),
'cov_args'
:
getattr
(
options
,
'cov_args'
,
''
),
}
python_suite
=
suites
.
PythonTestSuite
(
'Python Tests'
,
**
opts
)
...
...
pavelib/utils/test/suites/nose_suite.py
View file @
1f17fe12
...
...
@@ -23,6 +23,8 @@ class NoseTestSuite(TestSuite):
self
.
report_dir
=
Env
.
REPORT_DIR
/
self
.
root
self
.
test_id_dir
=
Env
.
TEST_DIR
/
self
.
root
self
.
test_ids
=
self
.
test_id_dir
/
'noseids'
self
.
extra_args
=
kwargs
.
get
(
'extra_args'
,
''
)
self
.
cov_args
=
kwargs
.
get
(
'cov_args'
,
''
)
def
__enter__
(
self
):
super
(
NoseTestSuite
,
self
)
.
__enter__
()
...
...
@@ -52,8 +54,9 @@ class NoseTestSuite(TestSuite):
cmd0
=
"`which {}`"
.
format
(
cmd0
)
cmd
=
(
"python -m coverage run --rcfile={root}/.coveragerc "
"python -m coverage run
{cov_args}
--rcfile={root}/.coveragerc "
"{cmd0} {cmd_rest}"
.
format
(
cov_args
=
self
.
cov_args
,
root
=
self
.
root
,
cmd0
=
cmd0
,
cmd_rest
=
cmd_rest
,
...
...
@@ -106,11 +109,12 @@ class SystemTestSuite(NoseTestSuite):
def
cmd
(
self
):
cmd
=
(
'./manage.py {system} test --verbosity={verbosity} '
'{test_id} {test_opts} --traceback --settings=test'
.
format
(
'{test_id} {test_opts} --traceback --settings=test
{extra}
'
.
format
(
system
=
self
.
root
,
verbosity
=
self
.
verbosity
,
test_id
=
self
.
test_id
,
test_opts
=
self
.
test_options_flags
,
extra
=
self
.
extra_args
,
)
)
...
...
@@ -157,13 +161,14 @@ class LibTestSuite(NoseTestSuite):
def
cmd
(
self
):
cmd
=
(
"nosetests --id-file={test_ids} {test_id} {test_opts} "
"--with-xunit --xunit-file={xunit_report} "
"--with-xunit --xunit-file={xunit_report}
{extra}
"
"--verbosity={verbosity}"
.
format
(
test_ids
=
self
.
test_ids
,
test_id
=
self
.
test_id
,
test_opts
=
self
.
test_options_flags
,
xunit_report
=
self
.
xunit_report
,
verbosity
=
self
.
verbosity
,
extra
=
self
.
extra_args
,
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment