Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
c3145ff1
Commit
c3145ff1
authored
Nov 24, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New neotestrunner option for code coverage testing
parent
4ef05b9e
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
34 additions
and
20 deletions
+34
-20
.gitignore
.gitignore
+2
-0
TESTS.txt
TESTS.txt
+0
-18
TODO
TODO
+1
-0
neo/scripts/runner.py
neo/scripts/runner.py
+19
-1
setup.py
setup.py
+1
-1
tools/coverage-html
tools/coverage-html
+11
-0
No files found.
.gitignore
View file @
c3145ff1
...
...
@@ -2,7 +2,9 @@
*.pyo
*.swp
*~
/.coverage
/build/
/dist/
/htmlcov/
/mock.py
/neoppod.egg-info/
TESTS.txt
deleted
100644 → 0
View file @
4ef05b9e
In order to check the test-coverage of Neo, we used the figleaf tool. The usage
(for a complete neo test suite) is :
Download and install figleaf : http://darcs.idyll.org/~t/projects/figleaf/doc/
$ figleaf neotestrunner -u (it will generate a .figleaf file)
$figleaf2html .figleaf (to convert .figleaf file in html pages)
$firefox html/ (to read the results)
Each one of the page contains Neo code, which the following colours :
Green : Executed code during test suite
Red : Unexecuted code
Black : Comments and "unused" lines
In order to check only needed neo file, you should specify the following options:
figleaf -i : ignore python libraries
figleaf2html -f : allows to specify a list of check-needed files
For stats, you can also check the index.html page, which indicated which
percentage of test-coverage.
TODO
View file @
c3145ff1
...
...
@@ -15,6 +15,7 @@
General
- Review XXX/TODO code tags (CODE)
- Coverage for functional tests (i.e. collect results from subprocesses)
- When all cells are OUT_OF_DATE in backup mode, the one with most data
could become UP_TO_DATE with appropriate backup_tid, so that the cluster
stays operational. (FEATURE)
...
...
neo/scripts/runner.py
View file @
c3145ff1
...
...
@@ -20,11 +20,23 @@ import unittest
import
logging
import
time
import
sys
import
neo
import
os
import
re
from
collections
import
Counter
,
defaultdict
from
cStringIO
import
StringIO
from
unittest.runner
import
_WritelnDecorator
if
filter
(
re
.
compile
(
r'--coverage$|-\
w*c
').match, sys.argv[1:]):
# Start coverage as soon as possible.
import coverage
coverage = coverage.Coverage(source=('
neo
',), omit=(
'
neo
/
debug
.
py
',
'
neo
/
scripts
/
runner
.
py
',
'
neo
/
tests
/*
',
))
coverage.start()
import neo
from neo.tests import getTempDirectory, __dict__ as neo_tests__dict__
from neo.tests.benchmark import BenchmarkRunner
...
...
@@ -201,6 +213,8 @@ class NeoTestRunner(unittest.TextTestResult):
class TestRunner(BenchmarkRunner):
def add_options(self, parser):
parser.add_option('
-
c
', '
--
coverage
', action='
store_true
',
help='
Enable
coverage
(
not
working
yet
for
functional
tests
)
')
parser.add_option('
-
f', '
--
functional
', action='
store_true
',
help='
Functional
tests
')
parser.add_option('
-
u', '
--
unit
', action='
store_true
',
...
...
@@ -238,6 +252,7 @@ Environment Variables:
functional = options.functional,
zodb = options.zodb,
verbosity = 2 if options.verbose else 1,
coverage = options.coverage,
)
def start(self):
...
...
@@ -254,6 +269,9 @@ Environment Variables:
except KeyboardInterrupt:
config['
mail_to
'] = None
traceback.print_exc()
if config.coverage:
coverage.stop()
coverage.save()
# build report
self._successful = runner.wasSuccessful()
return runner.buildReport(self.add_status)
...
...
setup.py
View file @
c3145ff1
...
...
@@ -38,7 +38,7 @@ extras_require = {
'storage-mysqldb'
:
[
'mysqlclient'
],
'storage-importer'
:
zodb_require
,
}
extras_require
[
'tests'
]
=
[
'zope.testing'
,
'psutil>=2'
,
extras_require
[
'tests'
]
=
[
'
coverage'
,
'
zope.testing'
,
'psutil>=2'
,
'neoppod[%s]'
%
', '
.
join
(
extras_require
)]
try
:
...
...
tools/coverage-html
0 → 100755
View file @
c3145ff1
#!/bin/sh -e
for
COV
in
coverage python-coverage
do
type
$COV
&&
break
done
>
/dev/null 2>&1
||
exit
$COV
html
# https://bitbucket.org/ned/coveragepy/issues/474/javascript-in-html-captures-all-keys
sed
-i
"
/assign_shortkeys *=/s/
$/
return;/
/^ *
\.
bind('keydown',/s,^,//,
"
htmlcov/coverage_html.js
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