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
77f27e99
Commit
77f27e99
authored
Sep 30, 2017
by
MaxBo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add regex to ######## coverage_test.py ########
remove deprecieated import in Coverage.py
parent
ca0e7284
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
20 deletions
+12
-20
Cython/Coverage.py
Cython/Coverage.py
+0
-1
tests/run/coverage_api.srctree
tests/run/coverage_api.srctree
+12
-19
No files found.
Cython/Coverage.py
View file @
77f27e99
...
...
@@ -9,7 +9,6 @@ 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+
...
...
tests/run/coverage_api.srctree
View file @
77f27e99
...
...
@@ -4,7 +4,6 @@
"""
PYTHON -c "import shutil; shutil.copy('pkg/coverage_test_pyx.pyx', 'pkg/coverage_test_pyx.pxi')"
PYTHON setup.py build_ext -i
PYTHON rename_pyd.py
PYTHON coverage_test.py
"""
...
...
@@ -25,20 +24,6 @@ setup(ext_modules = cythonize([
plugins = Cython.Coverage
######## rename_pyd.py ########
import os
import glob
pyd_files = glob.glob('**/*.pyd', recursive=True)
for filepath in pyd_files:
folder, fn = os.path.split(filepath)
basename, ext = os.path.splitext(fn)
new_name = os.path.splitext(basename)[0] + '.pyd'
new_filepath = os.path.join(folder, new_name)
os.rename(filepath, new_filepath)
######## pkg/__init__.py ########
######## pkg/coverage_test_py.py ########
...
...
@@ -159,10 +144,18 @@ for module in [coverage_test_py, coverage_test_pyx, coverage_test_include_pyx,
def source_file_for(module):
module_name = module.__name__
path, ext = os.path.splitext(module.__file__)
platform_suffix = re.search(r'[.](?:cpython|pypy)-[0-9]+[^.]*$', path, re.I)
if platform_suffix:
path = path[:platform_suffix.start()]
return path + '.' + module_name.rsplit('_', 1)[-1]
if ext == '.so':
# Linux/Unix/Mac extension module
platform_suffix = re.search(r'[.](?:cpython|pypy)-[0-9]+[-_a-z0-9]*$', path, re.I)
if platform_suffix:
path = path[:platform_suffix.start()]
elif ext == '.pyd':
# Windows extension module
platform_suffix = re.search(r'[.]cp[0-9]+-win[_a-z0-9]*$', path, re.I)
if platform_suffix:
path = path[:platform_suffix.start()]
source_filepath = path + '.' + module_name.rsplit('_', 1)[-1]
return source_filepath
def run_coverage(module):
...
...
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