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
24bc455f
Commit
24bc455f
authored
Apr 28, 2011
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More flexible testrunner extension customization.
parent
8554dcda
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
19 deletions
+23
-19
runtests.py
runtests.py
+23
-19
No files found.
runtests.py
View file @
24bc455f
...
...
@@ -69,20 +69,18 @@ if sys.platform == 'win32':
distutils_distro
.
parse_config_files
(
cfgfiles
)
EXT_DEP_MODULES
=
{
'
numpy'
:
'tag:
numpy'
,
'
pstats'
:
'tag:
pstats'
,
'
posix'
:
'tag:
posix'
,
'
tag:numpy'
:
'
numpy'
,
'
tag:pstats'
:
'
pstats'
,
'
tag:posix'
:
'
posix'
,
}
def
get_numpy_include_dirs
(
):
def
update_numpy_extension
(
ext
):
import
numpy
return
[
numpy
.
get_include
()]
ext
.
include_dirs
.
append
(
numpy
.
get_include
())
# TODO: use tags
EXT_DEP_INCLUDES
=
[
# test name matcher , callable returning list
(
re
.
compile
(
'numpy_.*'
).
match
,
get_numpy_include_dirs
),
]
EXT_EXTRAS
=
{
'tag:numpy'
:
update_numpy_extension
,
}
# TODO: use tags
VER_DEP_MODULES
=
{
...
...
@@ -135,8 +133,6 @@ def memoize(f):
res
=
f
.
_cache
.
get
(
args
,
uncomputed
)
if
res
is
uncomputed
:
res
=
f
.
_cache
[
args
]
=
f
(
*
args
)
else
:
print
"dup"
,
args
return
res
return
func
...
...
@@ -493,6 +489,12 @@ class CythonCompileTestCase(unittest.TestCase):
def
run_distutils
(
self
,
test_directory
,
module
,
workdir
,
incdir
,
extra_extension_args
=
None
):
original_source
=
self
.
find_module_source_file
(
os
.
path
.
join
(
test_directory
,
module
+
'.pyx'
))
try
:
tags
=
parse_tags
(
original_source
)
except
IOError
:
tags
=
{}
cwd
=
os
.
getcwd
()
os
.
chdir
(
workdir
)
try
:
...
...
@@ -503,10 +505,6 @@ class CythonCompileTestCase(unittest.TestCase):
build_extension
.
finalize_options
()
if
COMPILER
:
build_extension
.
compiler
=
COMPILER
ext_include_dirs
=
[]
for
match
,
get_additional_include_dirs
in
EXT_DEP_INCLUDES
:
if
match
(
module
):
ext_include_dirs
+=
get_additional_include_dirs
()
ext_compile_flags
=
CFLAGS
[:]
if
build_extension
.
compiler
==
'mingw32'
:
ext_compile_flags
.
append
(
'-Wno-format'
)
...
...
@@ -518,10 +516,16 @@ class CythonCompileTestCase(unittest.TestCase):
extension
=
Extension
(
module
,
sources
=
self
.
source_files
(
workdir
,
module
,
related_files
),
include_dirs
=
ext_include_dirs
,
extra_compile_args
=
ext_compile_flags
,
**
extra_extension_args
)
for
matcher
,
fixer
in
EXT_EXTRAS
.
items
():
if
isinstance
(
matcher
,
str
):
del
EXT_EXTRAS
[
matcher
]
matcher
=
string_selector
(
matcher
)
EXT_EXTRAS
[
matcher
]
=
fixer
if
matcher
(
module
,
tags
):
extension
=
fixer
(
extension
)
or
extension
if
self
.
language
==
'cpp'
:
extension
.
language
=
'c++'
build_extension
.
extensions
=
[
extension
]
...
...
@@ -1007,9 +1011,9 @@ class EmbedTest(unittest.TestCase):
class
MissingDependencyExcluder
:
def
__init__
(
self
,
deps
):
# deps: { m
odule name : matcher func
}
# deps: { m
atcher func : module name
}
self
.
exclude_matchers
=
[]
for
m
od
,
matcher
in
deps
.
items
():
for
m
atcher
,
mod
in
deps
.
items
():
try
:
__import__
(
mod
)
except
ImportError
:
...
...
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