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
7eb196df
Commit
7eb196df
authored
Nov 06, 2012
by
Ned Batchelder
Committed by
Calen Pennington
Nov 08, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Run coverage directly instead of as a plugin. Also quiet the install and clean steps of tests.
parent
7033faf1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
18 deletions
+17
-18
cms/envs/test.py
+0
-3
lms/envs/test.py
+4
-10
rakefile
+13
-5
No files found.
cms/envs/test.py
View file @
7eb196df
...
@@ -14,9 +14,6 @@ from path import path
...
@@ -14,9 +14,6 @@ from path import path
# Nose Test Runner
# Nose Test Runner
INSTALLED_APPS
+=
(
'django_nose'
,)
INSTALLED_APPS
+=
(
'django_nose'
,)
NOSE_ARGS
=
[
'--cover-erase'
,
'--with-xunit'
,
'--with-xcoverage'
,
'--cover-html'
,
'--cover-inclusive'
]
for
app
in
os
.
listdir
(
PROJECT_ROOT
/
'djangoapps'
):
NOSE_ARGS
+=
[
'--cover-package'
,
app
]
TEST_RUNNER
=
'django_nose.NoseTestSuiteRunner'
TEST_RUNNER
=
'django_nose.NoseTestSuiteRunner'
TEST_ROOT
=
path
(
'test_root'
)
TEST_ROOT
=
path
(
'test_root'
)
...
...
lms/envs/test.py
View file @
7eb196df
...
@@ -29,16 +29,10 @@ SOUTH_TESTS_MIGRATE = False # To disable migrations and use syncdb instead
...
@@ -29,16 +29,10 @@ SOUTH_TESTS_MIGRATE = False # To disable migrations and use syncdb instead
INSTALLED_APPS
+=
(
'django_nose'
,)
INSTALLED_APPS
+=
(
'django_nose'
,)
NOSE_ARGS
=
[]
NOSE_ARGS
=
[]
# Turning off coverage speeds up tests dramatically... until we have better config,
NOSE_ARGS
=
[
# leave it here for manual fiddling.
'--with-xunit'
,
_coverage
=
True
# '-v', '--pdb', # When really stuck, uncomment to start debugger on error
if
_coverage
:
]
NOSE_ARGS
=
[
'--cover-erase'
,
'--with-xunit'
,
'--with-xcoverage'
,
'--cover-html'
,
# '-v', '--pdb', # When really stuck, uncomment to start debugger on error
'--cover-inclusive'
,
'--cover-html-dir'
,
os
.
environ
.
get
(
'NOSE_COVER_HTML_DIR'
,
'cover_html'
)]
for
app
in
os
.
listdir
(
PROJECT_ROOT
/
'djangoapps'
):
NOSE_ARGS
+=
[
'--cover-package'
,
app
]
TEST_RUNNER
=
'django_nose.NoseTestSuiteRunner'
TEST_RUNNER
=
'django_nose.NoseTestSuiteRunner'
# Local Directories
# Local Directories
...
...
rakefile
View file @
7eb196df
...
@@ -49,12 +49,12 @@ default_options = {
...
@@ -49,12 +49,12 @@ default_options = {
task
:predjango
do
task
:predjango
do
sh
(
"find . -type f -name *.pyc -delete"
)
sh
(
"find . -type f -name *.pyc -delete"
)
sh
(
'pip install -e common/lib/xmodule -e common/lib/capa'
)
sh
(
"pip install -q -e common/lib/xmodule -e common/lib/capa"
)
sh
(
'git submodule update --init'
)
sh
(
"git submodule update --init"
)
end
end
task
:clean_test_files
do
task
:clean_test_files
do
sh
(
"git clean -fdx test_root"
)
sh
(
"git clean -f
q
dx test_root"
)
end
end
[
:lms
,
:cms
,
:common
].
each
do
|
system
|
[
:lms
,
:cms
,
:common
].
each
do
|
system
|
...
@@ -84,11 +84,18 @@ end
...
@@ -84,11 +84,18 @@ end
$failed_tests
=
0
$failed_tests
=
0
def
run_under_coverage
(
cmd
)
cmd0
,
cmd_rest
=
cmd
.
split
(
" "
,
2
)
cmd
=
"coverage run `which
#{
cmd0
}
`
#{
cmd_rest
}
"
return
cmd
end
def
run_tests
(
system
,
report_dir
,
stop_on_failure
=
true
)
def
run_tests
(
system
,
report_dir
,
stop_on_failure
=
true
)
ENV
[
'NOSE_XUNIT_FILE'
]
=
File
.
join
(
report_dir
,
"nosetests.xml"
)
ENV
[
'NOSE_XUNIT_FILE'
]
=
File
.
join
(
report_dir
,
"nosetests.xml"
)
ENV
[
'NOSE_COVER_HTML_DIR'
]
=
File
.
join
(
report_dir
,
"cover"
)
ENV
[
'NOSE_COVER_HTML_DIR'
]
=
File
.
join
(
report_dir
,
"cover"
)
dirs
=
Dir
[
"common/djangoapps/*"
]
+
Dir
[
"
#{
system
}
/djangoapps/*"
]
dirs
=
Dir
[
"common/djangoapps/*"
]
+
Dir
[
"
#{
system
}
/djangoapps/*"
]
sh
(
django_admin
(
system
,
:test
,
'test'
,
*
dirs
.
each
))
do
|
ok
,
res
|
cmd
=
django_admin
(
system
,
:test
,
'test'
,
'--logging-clear-handlers'
,
*
dirs
.
each
)
sh
(
run_under_coverage
(
cmd
))
do
|
ok
,
res
|
if
!
ok
and
stop_on_failure
if
!
ok
and
stop_on_failure
abort
"Test failed!"
abort
"Test failed!"
end
end
...
@@ -152,7 +159,8 @@ Dir["common/lib/*"].each do |lib|
...
@@ -152,7 +159,8 @@ Dir["common/lib/*"].each do |lib|
desc
"Run tests for common lib
#{
lib
}
"
desc
"Run tests for common lib
#{
lib
}
"
task
task_name
=>
report_dir
do
task
task_name
=>
report_dir
do
ENV
[
'NOSE_XUNIT_FILE'
]
=
File
.
join
(
report_dir
,
"nosetests.xml"
)
ENV
[
'NOSE_XUNIT_FILE'
]
=
File
.
join
(
report_dir
,
"nosetests.xml"
)
sh
(
"nosetests
#{
lib
}
--cover-erase --with-xunit --with-xcoverage --cover-html --cover-inclusive --cover-package
#{
File
.
basename
(
lib
)
}
--cover-html-dir
#{
File
.
join
(
report_dir
,
"cover"
)
}
"
)
cmd
=
"nosetests
#{
lib
}
--logging-clear-handlers --with-xunit"
sh
(
run_under_coverage
(
cmd
))
end
end
TEST_TASKS
<<
task_name
TEST_TASKS
<<
task_name
...
...
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