Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
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
Stefane Fermigier
neo
Commits
5de0ff3a
Commit
5de0ff3a
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
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
36 additions
and
20 deletions
+36
-20
.coveragerc
.coveragerc
+6
-0
.gitignore
.gitignore
+2
-0
TESTS.txt
TESTS.txt
+0
-18
TODO
TODO
+1
-0
neo/scripts/runner.py
neo/scripts/runner.py
+15
-1
setup.py
setup.py
+1
-1
tools/coverage-html
tools/coverage-html
+11
-0
No files found.
.coveragerc
0 → 100644
View file @
5de0ff3a
[run]
source = neo
omit =
neo/debug.py
neo/scripts/runner.py
neo/tests/*
.gitignore
View file @
5de0ff3a
...
@@ -2,7 +2,9 @@
...
@@ -2,7 +2,9 @@
*.pyo
*.pyo
*.swp
*.swp
*~
*~
/.coverage
/build/
/build/
/dist/
/dist/
/htmlcov/
/mock.py
/mock.py
/neoppod.egg-info/
/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 @
5de0ff3a
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
General
General
- Review XXX/TODO code tags (CODE)
- 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
- 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
could become UP_TO_DATE with appropriate backup_tid, so that the cluster
stays operational. (FEATURE)
stays operational. (FEATURE)
...
...
neo/scripts/runner.py
View file @
5de0ff3a
...
@@ -20,11 +20,19 @@ import unittest
...
@@ -20,11 +20,19 @@ import unittest
import
logging
import
logging
import
time
import
time
import
sys
import
sys
import
neo
import
os
import
os
import
re
from
collections
import
Counter
,
defaultdict
from
collections
import
Counter
,
defaultdict
from
cStringIO
import
StringIO
from
cStringIO
import
StringIO
from
unittest.runner
import
_WritelnDecorator
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()
coverage.start()
import neo
from neo.tests import getTempDirectory, __dict__ as neo_tests__dict__
from neo.tests import getTempDirectory, __dict__ as neo_tests__dict__
from neo.tests.benchmark import BenchmarkRunner
from neo.tests.benchmark import BenchmarkRunner
...
@@ -201,6 +209,8 @@ class NeoTestRunner(unittest.TextTestResult):
...
@@ -201,6 +209,8 @@ class NeoTestRunner(unittest.TextTestResult):
class TestRunner(BenchmarkRunner):
class TestRunner(BenchmarkRunner):
def add_options(self, parser):
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
',
parser.add_option('
-
f', '
--
functional
', action='
store_true
',
help='
Functional
tests
')
help='
Functional
tests
')
parser.add_option('
-
u', '
--
unit
', action='
store_true
',
parser.add_option('
-
u', '
--
unit
', action='
store_true
',
...
@@ -238,6 +248,7 @@ Environment Variables:
...
@@ -238,6 +248,7 @@ Environment Variables:
functional = options.functional,
functional = options.functional,
zodb = options.zodb,
zodb = options.zodb,
verbosity = 2 if options.verbose else 1,
verbosity = 2 if options.verbose else 1,
coverage = options.coverage,
)
)
def start(self):
def start(self):
...
@@ -254,6 +265,9 @@ Environment Variables:
...
@@ -254,6 +265,9 @@ Environment Variables:
except KeyboardInterrupt:
except KeyboardInterrupt:
config['
mail_to
'] = None
config['
mail_to
'] = None
traceback.print_exc()
traceback.print_exc()
if config.coverage:
coverage.stop()
coverage.save()
# build report
# build report
self._successful = runner.wasSuccessful()
self._successful = runner.wasSuccessful()
return runner.buildReport(self.add_status)
return runner.buildReport(self.add_status)
...
...
setup.py
View file @
5de0ff3a
...
@@ -38,7 +38,7 @@ extras_require = {
...
@@ -38,7 +38,7 @@ extras_require = {
'storage-mysqldb'
:
[
'mysqlclient'
],
'storage-mysqldb'
:
[
'mysqlclient'
],
'storage-importer'
:
zodb_require
,
'storage-importer'
:
zodb_require
,
}
}
extras_require
[
'tests'
]
=
[
'zope.testing'
,
'psutil>=2'
,
extras_require
[
'tests'
]
=
[
'
coverage'
,
'
zope.testing'
,
'psutil>=2'
,
'neoppod[%s]'
%
', '
.
join
(
extras_require
)]
'neoppod[%s]'
%
', '
.
join
(
extras_require
)]
try
:
try
:
...
...
tools/coverage-html
0 → 100755
View file @
5de0ff3a
#!/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