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
15eb19bf
Commit
15eb19bf
authored
Feb 21, 2015
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
teach Cython.Coverage about "pkg.mod.pyx" file name patterns
parent
b42255e4
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
8 deletions
+21
-8
Cython/Coverage.py
Cython/Coverage.py
+20
-8
Cython/Utils.py
Cython/Utils.py
+1
-0
No files found.
Cython/Coverage.py
View file @
15eb19bf
...
...
@@ -11,10 +11,22 @@ from collections import defaultdict
from
coverage.plugin
import
CoveragePlugin
,
FileTracer
,
FileReporter
# requires coverage.py 4.0+
from
coverage.files
import
FileLocator
# requires coverage.py 4.0+
from
.Utils
import
find_root_package_dir
from
.
import
__version__
def
_find_c_source
(
base_path
):
if
os
.
path
.
exists
(
base_path
+
'.c'
):
c_file
=
base_path
+
'.c'
elif
os
.
path
.
exists
(
base_path
+
'.cpp'
):
c_file
=
base_path
+
'.cpp'
else
:
c_file
=
None
return
c_file
class
Plugin
(
CoveragePlugin
):
_c_files_map
=
None
...
...
@@ -71,14 +83,14 @@ class Plugin(CoveragePlugin):
# none of our business
return
None
,
None
if
ext
in
(
'.c'
,
'.cpp'
):
c_file
=
filename
elif
os
.
path
.
exists
(
basename
+
'.c'
):
c_file
=
basename
+
'.c'
elif
os
.
path
.
exists
(
basename
+
'.cpp'
):
c_file
=
basename
+
'.cpp'
else
:
c_file
=
None
c_file
=
filename
if
ext
in
(
'.c'
,
'.cpp'
)
else
_find_c_source
(
basename
)
if
c_file
is
None
:
# a module "pkg/mod.so" can have a source file "pkg/pkg.mod.c"
package_root
=
find_root_package_dir
.
uncached
(
filename
)
package_path
=
os
.
path
.
relpath
(
basename
,
package_root
).
split
(
os
.
path
.
sep
)
if
len
(
package_path
)
>
1
:
test_basepath
=
os
.
path
.
join
(
os
.
path
.
dirname
(
filename
),
'.'
.
join
(
package_path
))
c_file
=
_find_c_source
(
test_basepath
)
py_source_file
=
None
if
c_file
:
...
...
Cython/Utils.py
View file @
15eb19bf
...
...
@@ -21,6 +21,7 @@ def cached_function(f):
if
res
is
uncomputed
:
res
=
cache
[
args
]
=
f
(
*
args
)
return
res
wrapper
.
uncached
=
f
return
wrapper
def
cached_method
(
f
):
...
...
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