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
20f028eb
Commit
20f028eb
authored
Dec 19, 2015
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #473 from watsona4/path-search-fix
Path search fix
parents
0c62e665
81c126c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
Cython/Coverage.py
Cython/Coverage.py
+9
-2
No files found.
Cython/Coverage.py
View file @
20f028eb
...
...
@@ -8,6 +8,7 @@ from __future__ import absolute_import
import
re
import
os.path
import
sys
from
collections
import
defaultdict
from
coverage.plugin
import
CoveragePlugin
,
FileTracer
,
FileReporter
# requires coverage.py 4.0+
...
...
@@ -35,6 +36,12 @@ def _find_dep_file_path(main_file, file_path):
pxi_file_path
=
os
.
path
.
join
(
os
.
path
.
dirname
(
main_file
),
file_path
)
if
os
.
path
.
exists
(
pxi_file_path
):
abs_path
=
os
.
path
.
abspath
(
pxi_file_path
)
# search sys.path for external locations if a valid file hasn't been found
if
not
os
.
path
.
exists
(
abs_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
test_path
return
abs_path
...
...
@@ -132,7 +139,7 @@ class Plugin(CoveragePlugin):
try
:
with
open
(
c_file
,
'rb'
)
as
f
:
if
b'/* Generated by Cython '
not
in
f
.
read
(
30
):
return
None
# not a Cython file
return
None
,
None
# not a Cython file
except
(
IOError
,
OSError
):
c_file
=
None
...
...
@@ -238,7 +245,7 @@ class CythonModuleTracer(FileTracer):
return self._file_path_map[source_file]
except KeyError:
pass
abs_path =
os.path.abspath(
source_file)
abs_path =
_find_dep_file_path(filename,
source_file)
if self.py_file and source_file[-3:].lower() == '
.
py
':
# always let coverage.py handle this case itself
...
...
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