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
3852db8b
Commit
3852db8b
authored
Apr 28, 2011
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
9c12fde7
96781217
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
33 deletions
+44
-33
runtests.py
runtests.py
+43
-32
tests/errors/w_cdef_override.pyx
tests/errors/w_cdef_override.pyx
+1
-1
No files found.
runtests.py
View file @
3852db8b
...
@@ -69,20 +69,18 @@ if sys.platform == 'win32':
...
@@ -69,20 +69,18 @@ if sys.platform == 'win32':
distutils_distro
.
parse_config_files
(
cfgfiles
)
distutils_distro
.
parse_config_files
(
cfgfiles
)
EXT_DEP_MODULES
=
{
EXT_DEP_MODULES
=
{
'
numpy'
:
'tag:
numpy'
,
'
tag:numpy'
:
'
numpy'
,
'
pstats'
:
'tag:
pstats'
,
'
tag:pstats'
:
'
pstats'
,
'
posix'
:
'tag:
posix'
,
'
tag:posix'
:
'
posix'
,
}
}
def
get_numpy_include_dirs
(
):
def
update_numpy_extension
(
ext
):
import
numpy
import
numpy
return
[
numpy
.
get_include
()]
ext
.
include_dirs
.
append
(
numpy
.
get_include
())
# TODO: use tags
EXT_EXTRAS
=
{
EXT_DEP_INCLUDES
=
[
'tag:numpy'
:
update_numpy_extension
,
# test name matcher , callable returning list
}
(
re
.
compile
(
'numpy_.*'
).
match
,
get_numpy_include_dirs
),
]
# TODO: use tags
# TODO: use tags
VER_DEP_MODULES
=
{
VER_DEP_MODULES
=
{
...
@@ -159,6 +157,8 @@ def parse_tags(filepath):
...
@@ -159,6 +157,8 @@ def parse_tags(filepath):
parse_tags
=
memoize
(
parse_tags
)
parse_tags
=
memoize
(
parse_tags
)
list_unchanging_dir
=
memoize
(
lambda
x
:
os
.
listdir
(
x
))
class
build_ext
(
_build_ext
):
class
build_ext
(
_build_ext
):
def
build_extension
(
self
,
ext
):
def
build_extension
(
self
,
ext
):
...
@@ -245,7 +245,7 @@ class TestBuilder(object):
...
@@ -245,7 +245,7 @@ class TestBuilder(object):
os
.
makedirs
(
workdir
)
os
.
makedirs
(
workdir
)
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
filenames
=
os
.
list
dir
(
path
)
filenames
=
list_unchanging_
dir
(
path
)
filenames
.
sort
()
filenames
.
sort
()
for
filename
in
filenames
:
for
filename
in
filenames
:
filepath
=
os
.
path
.
join
(
path
,
filename
)
filepath
=
os
.
path
.
join
(
path
,
filename
)
...
@@ -297,7 +297,7 @@ class TestBuilder(object):
...
@@ -297,7 +297,7 @@ class TestBuilder(object):
return
suite
return
suite
def
build_tests
(
self
,
test_class
,
path
,
workdir
,
module
,
expect_errors
,
tags
):
def
build_tests
(
self
,
test_class
,
path
,
workdir
,
module
,
expect_errors
,
tags
):
if
'werror'
in
tags
[
'tag
s
'
]:
if
'werror'
in
tags
[
'tag'
]:
warning_errors
=
True
warning_errors
=
True
else
:
else
:
warning_errors
=
False
warning_errors
=
False
...
@@ -414,19 +414,21 @@ class CythonCompileTestCase(unittest.TestCase):
...
@@ -414,19 +414,21 @@ class CythonCompileTestCase(unittest.TestCase):
def
build_target_filename
(
self
,
module_name
):
def
build_target_filename
(
self
,
module_name
):
target
=
'%s.%s'
%
(
module_name
,
self
.
language
)
target
=
'%s.%s'
%
(
module_name
,
self
.
language
)
return
target
return
target
def
copy_related_files
(
self
,
test_directory
,
targe
t_directory
,
module_name
):
def
related_files
(
self
,
tes
t_directory
,
module_name
):
is_related
=
re
.
compile
(
'%s_.*[.].*'
%
module_name
).
match
is_related
=
re
.
compile
(
'%s_.*[.].*'
%
module_name
).
match
for
filename
in
os
.
listdir
(
test_directory
):
return
[
filename
for
filename
in
list_unchanging_dir
(
test_directory
)
if
is_related
(
filename
):
if
is_related
(
filename
)]
shutil
.
copy
(
os
.
path
.
join
(
test_directory
,
filename
),
target_directory
)
def
copy_files
(
self
,
test_directory
,
target_directory
,
file_list
):
for
filename
in
file_list
:
shutil
.
copy
(
os
.
path
.
join
(
test_directory
,
filename
),
target_directory
)
def
find_source_files
(
self
,
workdir
,
module_name
):
def
source_files
(
self
,
workdir
,
module_name
,
file_list
):
is_related
=
re
.
compile
(
'%s_.*[.]%s'
%
(
module_name
,
self
.
language
)).
match
return
([
self
.
build_target_filename
(
module_name
)]
+
return
[
self
.
build_target_filename
(
module_name
)]
+
[
[
filename
for
filename
in
file_list
filename
for
filename
in
os
.
listdir
(
workdir
)
if
not
os
.
path
.
isfile
(
os
.
path
.
join
(
workdir
,
filename
))])
if
is_related
(
filename
)
and
os
.
path
.
isfile
(
os
.
path
.
join
(
workdir
,
filename
))
]
def
split_source_and_output
(
self
,
test_directory
,
module
,
workdir
):
def
split_source_and_output
(
self
,
test_directory
,
module
,
workdir
):
source_file
=
self
.
find_module_source_file
(
os
.
path
.
join
(
test_directory
,
module
)
+
'.pyx'
)
source_file
=
self
.
find_module_source_file
(
os
.
path
.
join
(
test_directory
,
module
)
+
'.pyx'
)
...
@@ -487,6 +489,12 @@ class CythonCompileTestCase(unittest.TestCase):
...
@@ -487,6 +489,12 @@ class CythonCompileTestCase(unittest.TestCase):
def
run_distutils
(
self
,
test_directory
,
module
,
workdir
,
incdir
,
def
run_distutils
(
self
,
test_directory
,
module
,
workdir
,
incdir
,
extra_extension_args
=
None
):
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
()
cwd
=
os
.
getcwd
()
os
.
chdir
(
workdir
)
os
.
chdir
(
workdir
)
try
:
try
:
...
@@ -497,24 +505,27 @@ class CythonCompileTestCase(unittest.TestCase):
...
@@ -497,24 +505,27 @@ class CythonCompileTestCase(unittest.TestCase):
build_extension
.
finalize_options
()
build_extension
.
finalize_options
()
if
COMPILER
:
if
COMPILER
:
build_extension
.
compiler
=
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
[:]
ext_compile_flags
=
CFLAGS
[:]
if
build_extension
.
compiler
==
'mingw32'
:
if
build_extension
.
compiler
==
'mingw32'
:
ext_compile_flags
.
append
(
'-Wno-format'
)
ext_compile_flags
.
append
(
'-Wno-format'
)
if
extra_extension_args
is
None
:
if
extra_extension_args
is
None
:
extra_extension_args
=
{}
extra_extension_args
=
{}
self
.
copy_related_files
(
test_directory
,
workdir
,
module
)
related_files
=
self
.
related_files
(
test_directory
,
module
)
self
.
copy_files
(
test_directory
,
workdir
,
related_files
)
extension
=
Extension
(
extension
=
Extension
(
module
,
module
,
sources
=
self
.
find_source_files
(
workdir
,
module
),
sources
=
self
.
source_files
(
workdir
,
module
,
related_files
),
include_dirs
=
ext_include_dirs
,
extra_compile_args
=
ext_compile_flags
,
extra_compile_args
=
ext_compile_flags
,
**
extra_extension_args
**
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'
:
if
self
.
language
==
'cpp'
:
extension
.
language
=
'c++'
extension
.
language
=
'c++'
build_extension
.
extensions
=
[
extension
]
build_extension
.
extensions
=
[
extension
]
...
@@ -1000,9 +1011,9 @@ class EmbedTest(unittest.TestCase):
...
@@ -1000,9 +1011,9 @@ class EmbedTest(unittest.TestCase):
class
MissingDependencyExcluder
:
class
MissingDependencyExcluder
:
def
__init__
(
self
,
deps
):
def
__init__
(
self
,
deps
):
# deps: { m
odule name : matcher func
}
# deps: { m
atcher func : module name
}
self
.
exclude_matchers
=
[]
self
.
exclude_matchers
=
[]
for
m
od
,
matcher
in
deps
.
items
():
for
m
atcher
,
mod
in
deps
.
items
():
try
:
try
:
__import__
(
mod
)
__import__
(
mod
)
except
ImportError
:
except
ImportError
:
...
...
tests/errors/w_cdef_override.pyx
View file @
3852db8b
# mode: error
# mode: error
# tag
s
: werror
# tag: werror
cdef
foo
():
cdef
foo
():
pass
pass
...
...
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