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
e98c5580
Commit
e98c5580
authored
Jan 30, 2015
by
Christine Lytwynec
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
split unittests into shards for in jenkins
parent
81d51f96
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
50 additions
and
13 deletions
+50
-13
pavelib/js_test.py
+4
-2
pavelib/tests.py
+12
-3
pavelib/utils/test/suites/acceptance_suite.py
+2
-1
pavelib/utils/test/suites/bokchoy_suite.py
+3
-1
pavelib/utils/test/suites/js_suite.py
+2
-1
pavelib/utils/test/suites/python_suite.py
+1
-1
pavelib/utils/test/suites/suite.py
+1
-0
pavelib/utils/test/utils.py
+9
-2
scripts/all-tests.sh
+16
-2
No files found.
pavelib/js_test.py
View file @
e98c5580
...
...
@@ -19,13 +19,15 @@ __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'
),
],
share_with
=
[
"pavelib.utils.tests.utils.clean_reports_dir"
])
def
test_js
(
options
):
"""
Run the JavaScript tests
"""
mode
=
getattr
(
options
,
'mode'
,
'run'
)
port
=
None
skip_clean
=
getattr
(
options
,
'skip_clean'
,
False
)
if
mode
==
'run'
:
suite
=
getattr
(
options
,
'suite'
,
'all'
)
...
...
@@ -46,7 +48,7 @@ def test_js(options):
)
return
test_suite
=
JsTestSuite
(
suite
,
mode
=
mode
,
with_coverage
=
coverage
,
port
=
port
)
test_suite
=
JsTestSuite
(
suite
,
mode
=
mode
,
with_coverage
=
coverage
,
port
=
port
,
skip_clean
=
skip_clean
)
test_suite
.
run
()
...
...
pavelib/tests.py
View file @
e98c5580
...
...
@@ -29,10 +29,11 @@ __test__ = False # do not collect
(
"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'
),
(
'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
),
])
]
,
share_with
=
[
'pavelib.utils.test.utils.clean_reports_dir'
]
)
def
test_system
(
options
):
"""
Run tests on our djangoapps for lms and cms
...
...
@@ -47,6 +48,7 @@ def test_system(options):
'verbosity'
:
getattr
(
options
,
'verbosity'
,
1
),
'extra_args'
:
getattr
(
options
,
'extra_args'
,
''
),
'cov_args'
:
getattr
(
options
,
'cov_args'
,
''
),
'skip_clean'
:
getattr
(
options
,
'skip_clean'
,
False
),
}
if
test_id
:
...
...
@@ -79,10 +81,11 @@ def test_system(options):
(
"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'
),
(
'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
),
])
]
,
share_with
=
[
'pavelib.utils.test.utils.clean_reports_dir'
]
)
def
test_lib
(
options
):
"""
Run tests for common/lib/ and pavelib/ (paver-tests)
...
...
@@ -96,6 +99,7 @@ def test_lib(options):
'verbosity'
:
getattr
(
options
,
'verbosity'
,
1
),
'extra_args'
:
getattr
(
options
,
'extra_args'
,
''
),
'cov_args'
:
getattr
(
options
,
'cov_args'
,
''
),
'skip_clean'
:
getattr
(
options
,
'skip_clean'
,
False
),
}
if
test_id
:
...
...
@@ -151,6 +155,9 @@ def test_python(options):
'pavelib.utils.test.utils.clean_reports_dir'
,
)
@cmdopts
([
(
"suites"
,
"s"
,
"List of unit test suites to run. (js, lib, cms, lms)"
),
(
'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
),
...
...
@@ -160,7 +167,9 @@ def test(options):
Run all tests
"""
opts
=
{
'verbosity'
:
getattr
(
options
,
'verbosity'
,
1
)
'verbosity'
:
getattr
(
options
,
'verbosity'
,
1
),
'extra_args'
:
getattr
(
options
,
'extra_args'
,
''
),
'cov_args'
:
getattr
(
options
,
'cov_args'
,
''
),
}
# Subsuites to be added to the main suite
python_suite
=
suites
.
PythonTestSuite
(
'Python Tests'
,
**
opts
)
...
...
pavelib/utils/test/suites/acceptance_suite.py
View file @
e98c5580
...
...
@@ -90,7 +90,8 @@ class AcceptanceTestSuite(TestSuite):
def
__enter__
(
self
):
super
(
AcceptanceTestSuite
,
self
)
.
__enter__
()
test_utils
.
clean_test_files
()
if
not
self
.
skip_clean
:
test_utils
.
clean_test_files
()
if
not
self
.
fasttest
:
self
.
_setup_acceptance_db
()
...
...
pavelib/utils/test/suites/bokchoy_suite.py
View file @
e98c5580
...
...
@@ -51,7 +51,9 @@ class BokChoyTestSuite(TestSuite):
self
.
har_dir
.
makedirs_p
()
self
.
report_dir
.
makedirs_p
()
test_utils
.
clean_reports_dir
()
test_utils
.
clean_test_files
()
if
not
self
.
skip_clean
:
test_utils
.
clean_test_files
()
msg
=
colorize
(
'green'
,
"Checking for mongo, memchache, and mysql..."
)
print
(
msg
)
...
...
pavelib/utils/test/suites/js_suite.py
View file @
e98c5580
...
...
@@ -32,7 +32,8 @@ class JsTestSuite(TestSuite):
def
__enter__
(
self
):
super
(
JsTestSuite
,
self
)
.
__enter__
()
self
.
report_dir
.
makedirs_p
()
test_utils
.
clean_test_files
()
if
not
self
.
skip_clean
:
test_utils
.
clean_test_files
()
if
self
.
mode
==
'run'
and
not
self
.
run_under_coverage
:
test_utils
.
clean_dir
(
self
.
report_dir
)
...
...
pavelib/utils/test/suites/python_suite.py
View file @
e98c5580
...
...
@@ -21,7 +21,7 @@ class PythonTestSuite(TestSuite):
def
__enter__
(
self
):
super
(
PythonTestSuite
,
self
)
.
__enter__
()
if
not
self
.
fasttest
:
if
not
(
self
.
fasttest
or
self
.
skip_clean
)
:
test_utils
.
clean_test_files
()
@property
...
...
pavelib/utils/test/suites/suite.py
View file @
e98c5580
...
...
@@ -22,6 +22,7 @@ class TestSuite(object):
self
.
subsuites
=
kwargs
.
get
(
'subsuites'
,
[])
self
.
failed_suites
=
[]
self
.
verbosity
=
kwargs
.
get
(
'verbosity'
,
1
)
self
.
skip_clean
=
kwargs
.
get
(
'skip_clean'
,
False
)
def
__enter__
(
self
):
"""
...
...
pavelib/utils/test/utils.py
View file @
e98c5580
"""
Helper functions for test tasks
"""
from
paver.easy
import
sh
,
task
from
paver.easy
import
sh
,
task
,
cmdopts
from
pavelib.utils.envs
import
Env
import
os
import
subprocess
...
...
@@ -33,10 +33,17 @@ def clean_dir(directory):
@task
def
clean_reports_dir
():
@cmdopts
([
(
'skip_clean'
,
'C'
,
'skip cleaning repository before running tests'
),
])
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...'
)
return
# We delete the files but preserve the directory structure
# so that coverage.py has a place to put the reports.
reports_dir
=
Env
.
REPORT_DIR
.
makedirs_p
()
...
...
scripts/all-tests.sh
View file @
e98c5580
...
...
@@ -126,8 +126,22 @@ END
;;
"unit"
)
paver
test
paver coverage
case
"
$SHARD
"
in
"lms"
)
paver test_system
-s
lms
paver coverage
;;
"other"
)
paver test_system
-s
cms
paver test_js
--coverage
--skip_clean
paver test_lib
--skip_clean
paver coverage
;;
*
)
paver
test
paver coverage
;;
esac
;;
"lms-acceptance"
)
...
...
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