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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
84a6a39b
Commit
84a6a39b
authored
Sep 30, 2017
by
MaxBo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use canonical_filename from coverage.files
parent
f6736838
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
33 deletions
+5
-33
Cython/Coverage.py
Cython/Coverage.py
+5
-33
No files found.
Cython/Coverage.py
View file @
84a6a39b
...
...
@@ -13,6 +13,7 @@ import glob
from
collections
import
defaultdict
from
coverage.plugin
import
CoveragePlugin
,
FileTracer
,
FileReporter
# requires coverage.py 4.0+
from
coverage.files
import
canonical_filename
from
.Utils
import
find_root_package_dir
,
is_package_dir
,
open_source_file
...
...
@@ -42,37 +43,8 @@ def _find_dep_file_path(main_file, file_path):
for
sys_path
in
sys
.
path
:
test_path
=
os
.
path
.
realpath
(
os
.
path
.
join
(
sys_path
,
file_path
))
if
os
.
path
.
exists
(
test_path
):
return
_get_actual_filename
(
test_path
)
return
_get_actual_filename
(
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
.
append
(
"{}[{}]"
.
format
(
d
[:
-
1
],
d
[
-
1
]))
res
=
glob
.
glob
(
'
\
\
'
.
join
(
test_name
))
if
not
res
:
#File not found
return
filepath
return
res
[
0
]
return
canonical_filename
(
test_path
)
return
canonical_filename
(
abs_path
)
class
Plugin
(
CoveragePlugin
):
...
...
@@ -93,7 +65,7 @@ class Plugin(CoveragePlugin):
if
filename
.
startswith
(
'<'
)
or
filename
.
startswith
(
'memory:'
):
return
None
c_file
=
py_file
=
None
filename
=
_get_actu
al_filename
(
os
.
path
.
abspath
(
filename
))
filename
=
canonic
al_filename
(
os
.
path
.
abspath
(
filename
))
if
self
.
_c_files_map
and
filename
in
self
.
_c_files_map
:
c_file
=
self
.
_c_files_map
[
filename
][
0
]
...
...
@@ -121,7 +93,7 @@ class Plugin(CoveragePlugin):
# from coverage.python import PythonFileReporter
# return PythonFileReporter(filename)
filename
=
_get_actu
al_filename
(
os
.
path
.
abspath
(
filename
))
filename
=
canonic
al_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
:
...
...
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