Commit 6222b1cd by Calen Pennington Committed by GitHub

Merge pull request #12749 from cpennington/jenkins-concurrent-unit-tests

Jenkins concurrent unit tests
parents df399de1 b839b048
...@@ -26,6 +26,8 @@ omit = ...@@ -26,6 +26,8 @@ omit =
openedx/core/djangoapps/*/migrations/* openedx/core/djangoapps/*/migrations/*
openedx/core/djangoapps/debug/* openedx/core/djangoapps/debug/*
concurrency=multiprocessing
[report] [report]
ignore_errors = True ignore_errors = True
......
...@@ -208,10 +208,16 @@ To run a single test format the command like this. ...@@ -208,10 +208,16 @@ To run a single test format the command like this.
paver test_system -t lms/djangoapps/courseware/tests/tests.py:ActivateLoginTest.test_activate_login 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. The ``lms`` suite of tests runs with randomized order, by default.
You can override these by using ``--no-randomize`` to disable randomization, 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: You can also enable test concurrency with the ``--processes=N`` flag (where ``N``
is the number of processes to run tests with, and ``-1`` means one process per
available core). Note, however, that when running concurrently, breakpoints may
not work correctly, and you will not be able to run single test methods (only
single test classes).
For example:
:: ::
# This will run all tests in the order that they appear in their files, serially # This will run all tests in the order that they appear in their files, serially
......
...@@ -126,8 +126,7 @@ class SystemTestSuite(NoseTestSuite): ...@@ -126,8 +126,7 @@ class SystemTestSuite(NoseTestSuite):
self.randomize = kwargs.get('randomize', None) self.randomize = kwargs.get('randomize', None)
if self.processes is None: if self.processes is None:
# Use one process per core for LMS tests, and no multiprocessing # Don't use multiprocessing by default
# otherwise.
self.processes = 0 self.processes = 0
self.processes = int(self.processes) self.processes = int(self.processes)
......
...@@ -25,7 +25,7 @@ class TestSuite(object): ...@@ -25,7 +25,7 @@ class TestSuite(object):
self.root = args[0] self.root = args[0]
self.subsuites = kwargs.get('subsuites', []) self.subsuites = kwargs.get('subsuites', [])
self.failed_suites = [] self.failed_suites = []
self.verbosity = kwargs.get('verbosity', 1) self.verbosity = int(kwargs.get('verbosity', 1))
self.skip_clean = kwargs.get('skip_clean', False) self.skip_clean = kwargs.get('skip_clean', False)
self.pdb = kwargs.get('pdb', False) self.pdb = kwargs.get('pdb', False)
......
...@@ -99,22 +99,23 @@ case "$TEST_SUITE" in ...@@ -99,22 +99,23 @@ case "$TEST_SUITE" in
;; ;;
"lms-unit") "lms-unit")
LMS_ARGS="--with-flaky" EXTRA_ARGS="--with-flaky"
PAVER_ARGS="--processes=-1 --cov_args='-p' -v"
case "$SHARD" in case "$SHARD" in
"all") "all")
paver test_system -s lms --extra_args="$LMS_ARGS" --cov_args="-p" -v paver test_system -s lms --extra_args="$EXTRA_ARGS" $PAVER_ARGS
;; ;;
"1") "1")
paver test_system -s lms --extra_args="--attr='shard_1' $LMS_ARGS" --cov_args="-p" -v paver test_system -s lms --extra_args="--attr='shard_1' $EXTRA_ARGS" $PAVER_ARGS
;; ;;
"2") "2")
paver test_system -s lms --extra_args="--attr='shard_2' $LMS_ARGS" --cov_args="-p" -v paver test_system -s lms --extra_args="--attr='shard_2' $EXTRA_ARGS" $PAVER_ARGS
;; ;;
"3") "3")
paver test_system -s lms --extra_args="--attr='shard_3' $LMS_ARGS" --cov_args="-p" -v paver test_system -s lms --extra_args="--attr='shard_3' $EXTRA_ARGS" $PAVER_ARGS
;; ;;
"4") "4")
paver test_system -s lms --extra_args="--attr='shard_1=False,shard_2=False,shard_3=False' $LMS_ARGS" --cov_args="-p" -v paver test_system -s lms --extra_args="--attr='shard_1=False,shard_2=False,shard_3=False' $EXTRA_ARGS" $PAVER_ARGS
;; ;;
*) *)
# If no shard is specified, rather than running all tests, create an empty xunit file. This is a # If no shard is specified, rather than running all tests, create an empty xunit file. This is a
......
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