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
Gwenaël Samain
cython
Commits
f9cf3aca
Commit
f9cf3aca
authored
Sep 29, 2017
by
Max Bohnet
Committed by
GitHub
Sep 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update Coverage.py
use filepath with the correct upper and lowercases
parent
644e693c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
2 deletions
+32
-2
Cython/Coverage.py
Cython/Coverage.py
+32
-2
No files found.
Cython/Coverage.py
View file @
f9cf3aca
...
...
@@ -9,6 +9,7 @@ from __future__ import absolute_import
import
re
import
os.path
import
sys
import
glob
from
collections
import
defaultdict
from
coverage.plugin
import
CoveragePlugin
,
FileTracer
,
FileReporter
# requires coverage.py 4.0+
...
...
@@ -45,6 +46,35 @@ def _find_dep_file_path(main_file, file_path):
return
abs_path
def
_get_actual_filename
(
filepath
):
"""
on windows:
search the file `filepath' on the file system
and return it with the correct upper/lowercases
on linux: return the filepath unmodified
Parameters
----------
filepath : str
Returns
-------
filepath : str
"""
if
not
sys
.
platform
.
startswith
(
'win'
):
return
filepath
dirs
=
filepath
.
split
(
'
\
\
'
)
# disk letter
test_name
=
[
dirs
[
0
].
upper
()]
for
d
in
dirs
[
1
:]:
test_name
+=
[
"%s[%s]"
%
(
d
[:
-
1
],
d
[
-
1
])]
res
=
glob
.
glob
(
'
\
\
'
.
join
(
test_name
))
if
not
res
:
#File not found
return
filepath
return
res
[
0
]
class
Plugin
(
CoveragePlugin
):
# map from traced file paths to absolute file paths
_file_path_map
=
None
...
...
@@ -91,7 +121,7 @@ class Plugin(CoveragePlugin):
# from coverage.python import PythonFileReporter
# return PythonFileReporter(filename)
filename
=
os
.
path
.
abspath
(
filename
)
filename
=
_get_actual_filename
(
os
.
path
.
abspath
(
filename
)
)
if
self
.
_c_files_map
and
filename
in
self
.
_c_files_map
:
c_file
,
rel_file_path
,
code
=
self
.
_c_files_map
[
filename
]
else
:
...
...
@@ -213,7 +243,7 @@ class Plugin(CoveragePlugin):
self._c_files_map = {}
for filename, code in code_lines.items():
abs_path = _
find_dep_file_path(c_file, filename
)
abs_path = _
get_actual_filename(_find_dep_file_path(c_file, filename)
)
self._c_files_map[abs_path] = (c_file, filename, code)
if sourcefile not in self._c_files_map:
...
...
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