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
e60114c7
Commit
e60114c7
authored
May 16, 2016
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add paver arguments to control concurrency and randomization
parent
a45f1f03
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
25 deletions
+44
-25
docs/en_us/internal/testing.rst
+12
-0
pavelib/tests.py
+5
-0
pavelib/utils/test/suites/nose_suite.py
+27
-25
No files found.
docs/en_us/internal/testing.rst
View file @
e60114c7
...
...
@@ -208,6 +208,18 @@ To run a single test format the command like this.
paver test_system -t lms/djangoapps/courseware/tests/tests.py:ActivateLoginTest.test_activate_login
The ``lms`` suite of tests runs concurrently, and with randomized order, by default.
You can override these by using ``--no-randomize`` to disable randomization,
and ``--processes=N`` to control how many tests will run concurrently (``0`` will
disable concurrency). For example:
::
# This will run all tests in the order that they appear in their files, serially
paver test_system -s lms --no-randomize --processes=0
# This will run using only 2 processes for tests
paver test_system -s lms --processes=2
To re-run all failing django tests from lms or cms, use the
``--failed``,\ ``-f`` flag (see note at end of section).
...
...
pavelib/tests.py
View file @
e60114c7
...
...
@@ -31,6 +31,9 @@ __test__ = False # do not collect
(
'extra_args='
,
'e'
,
'adds as extra args to the test command'
),
(
'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"
),
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
),
...
...
@@ -59,6 +62,8 @@ def test_system(options):
'skip_clean'
:
getattr
(
options
,
'skip_clean'
,
False
),
'pdb'
:
getattr
(
options
,
'pdb'
,
False
),
'disable_migrations'
:
getattr
(
options
,
'disable_migrations'
,
False
),
'processes'
:
getattr
(
options
,
'processes'
,
None
),
'randomize'
:
getattr
(
options
,
'randomize'
,
None
),
}
if
test_id
:
...
...
pavelib/utils/test/suites/nose_suite.py
View file @
e60114c7
...
...
@@ -113,36 +113,38 @@ class SystemTestSuite(NoseTestSuite):
self
.
test_id
=
kwargs
.
get
(
'test_id'
,
self
.
_default_test_id
)
self
.
fasttest
=
kwargs
.
get
(
'fasttest'
,
False
)
self
.
processes
=
kwargs
.
get
(
'processes'
,
None
)
self
.
randomize
=
kwargs
.
get
(
'randomize'
,
None
)
def
__enter__
(
self
):
super
(
SystemTestSuite
,
self
)
.
__enter__
()
@property
def
cmd
(
self
):
cmd
=
(
'./manage.py {system} test --verbosity={verbosity} '
'{test_id} {test_opts} --settings=test {system_opts} {extra} '
'--with-xunitmp --xunitmp-file={xunit_report}'
.
format
(
system
=
self
.
root
,
verbosity
=
self
.
verbosity
,
test_id
=
self
.
test_id
,
test_opts
=
self
.
test_options_flags
,
system_opts
=
self
.
_system_options
,
extra
=
self
.
extra_args
,
xunit_report
=
self
.
report_dir
/
"nosetests.xml"
,
)
)
return
self
.
_under_coverage_cmd
(
cmd
)
@property
def
_system_options
(
self
):
"""
Test arguments that are only enabled for specific systems.
"""
if
self
.
root
==
'lms'
:
return
'--with-randomly --with-database-isolation --processes=-1'
return
''
if
self
.
processes
is
None
:
# Use one process per core for LMS tests, and no multiprocessing
# otherwise.
self
.
processes
=
-
1
if
self
.
root
==
'lms'
else
0
if
self
.
randomize
is
None
:
self
.
randomize
=
self
.
root
==
'lms'
cmd
=
[
'./manage.py'
,
self
.
root
,
'test'
,
'--verbosity={}'
.
format
(
self
.
verbosity
),
self
.
test_id
,
self
.
test_options_flags
,
'--settings=test'
,
self
.
extra_args
,
'--with-xunitmp'
,
'--xunitmp-file={}'
.
format
(
self
.
report_dir
/
"nosetests.xml"
),
'--processes={}'
.
format
(
self
.
processes
),
'--with-database-isolation'
,
]
if
self
.
randomize
:
cmd
.
append
(
'--with-randomly'
)
return
self
.
_under_coverage_cmd
(
" "
.
join
(
cmd
))
@property
def
_default_test_id
(
self
):
...
...
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