Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
cython
Commits
31189fdb
Commit
31189fdb
authored
Feb 20, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extend coverage test to include XML reporting
parent
44059067
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
2 deletions
+29
-2
tests/run/coverage_cmd.srctree
tests/run/coverage_cmd.srctree
+29
-2
No files found.
tests/run/coverage_cmd.srctree
View file @
31189fdb
...
...
@@ -112,12 +112,18 @@ import os
import os.path
import subprocess
def run_report():
def run_coverage_command(*command):
env = dict(os.environ, LANG='', LC_ALL='C')
process = subprocess.Popen(
[sys.executable, '-m', 'coverage'
, 'report', '--show-missing']
,
[sys.executable, '-m', 'coverage'
] + list(command)
,
stdout=subprocess.PIPE, env=env)
stdout, _ = process.communicate()
return stdout
def run_report():
stdout = run_coverage_command('report', '--show-missing')
stdout = stdout.decode('iso8859-1') # 'safe' decoding
lines = stdout.splitlines()
print(stdout)
...
...
@@ -149,5 +155,26 @@ def run_report():
assert 12 not in files['coverage_test_pyx.pyx'][-1], files['coverage_test_pyx.pyx']
def run_xml_report():
stdout = run_coverage_command('xml', '-o', '-')
print(stdout)
import xml.etree.ElementTree as etree
data = etree.fromstring(stdout)
files = {}
for module in data.iterfind('.//class'):
files[module.get('filename').replace('\\', '/')] = dict(
(int(line.get('number')), int(line.get('hits')))
for line in module.findall('lines/line')
)
assert files['pkg/coverage_test_pyx.pyx'][5] > 0, files['pkg/coverage_test_pyx.pyx']
assert files['pkg/coverage_test_pyx.pyx'][6] > 0, files['pkg/coverage_test_pyx.pyx']
assert files['pkg/coverage_test_pyx.pyx'][7] > 0, files['pkg/coverage_test_pyx.pyx']
if __name__ == '__main__':
run_report()
run_xml_report()
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