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
6100f407
Commit
6100f407
authored
Apr 02, 2011
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test selection by tag.
parent
e45c29b7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
13 deletions
+46
-13
runtests.py
runtests.py
+46
-13
No files found.
runtests.py
View file @
6100f407
...
@@ -78,6 +78,9 @@ def get_numpy_include_dirs():
...
@@ -78,6 +78,9 @@ def get_numpy_include_dirs():
import numpy
import numpy
return [numpy.get_include()]
return [numpy.get_include()]
# TODO: use tags for these
EXT_DEP_INCLUDES = [
EXT_DEP_INCLUDES = [
# test name matcher , callable returning list
# test name matcher , callable returning list
(re.compile('
numpy_
.
*
').match, get_numpy_include_dirs),
(re.compile('
numpy_
.
*
').match, get_numpy_include_dirs),
...
@@ -239,12 +242,13 @@ class TestBuilder(object):
...
@@ -239,12 +242,13 @@ class TestBuilder(object):
if
filename
.
startswith
(
'.'
):
if
filename
.
startswith
(
'.'
):
continue
# certain emacs backup files
continue
# certain emacs backup files
tags
=
parse_tags
(
filepath
)
tags
=
parse_tags
(
filepath
)
fqmodule
=
"%s.%s"
%
(
context
,
filenam
e
)
fqmodule
=
"%s.%s"
%
(
context
,
modul
e
)
if
not
[
1
for
match
in
self
.
selectors
if
not
[
1
for
match
in
self
.
selectors
if
match
(
fqmodule
)
]:
if
match
(
fqmodule
,
tags
)
]:
continue
continue
if
self
.
exclude_selectors
:
if
self
.
exclude_selectors
:
if
[
1
for
match
in
self
.
exclude_selectors
if
match
(
fqmodule
)]:
if
[
1
for
match
in
self
.
exclude_selectors
if
match
(
fqmodule
,
tags
)]:
continue
continue
mode
=
'run'
# default
mode
=
'run'
# default
...
@@ -271,7 +275,7 @@ class TestBuilder(object):
...
@@ -271,7 +275,7 @@ class TestBuilder(object):
test_class
=
CythonCompileTestCase
test_class
=
CythonCompileTestCase
for
test
in
self
.
build_tests
(
test_class
,
path
,
workdir
,
for
test
in
self
.
build_tests
(
test_class
,
path
,
workdir
,
module
,
mode
==
'error'
):
module
,
mode
==
'error'
,
tags
):
suite
.
addTest
(
test
)
suite
.
addTest
(
test
)
if
mode
==
'run'
and
ext
==
'.py'
:
if
mode
==
'run'
and
ext
==
'.py'
:
# additionally test file in real Python
# additionally test file in real Python
...
@@ -279,15 +283,15 @@ class TestBuilder(object):
...
@@ -279,15 +283,15 @@ class TestBuilder(object):
return
suite
return
suite
def
build_tests
(
self
,
test_class
,
path
,
workdir
,
module
,
expect_errors
):
def
build_tests
(
self
,
test_class
,
path
,
workdir
,
module
,
expect_errors
,
tags
):
if
expect_errors
:
if
expect_errors
:
if
'cpp'
in
module
and
'cpp'
in
self
.
languages
:
if
'cpp'
in
tags
[
'tag'
]
and
'cpp'
in
self
.
languages
:
languages
=
[
'cpp'
]
languages
=
[
'cpp'
]
else
:
else
:
languages
=
self
.
languages
[:
1
]
languages
=
self
.
languages
[:
1
]
else
:
else
:
languages
=
self
.
languages
languages
=
self
.
languages
if
'cpp'
in
module
and
'c'
in
languages
:
if
'cpp'
in
tags
[
'tag'
]
and
'c'
in
languages
:
languages
=
list
(
languages
)
languages
=
list
(
languages
)
languages
.
remove
(
'c'
)
languages
.
remove
(
'c'
)
tests
=
[
self
.
build_test
(
test_class
,
path
,
workdir
,
module
,
tests
=
[
self
.
build_test
(
test_class
,
path
,
workdir
,
module
,
...
@@ -961,7 +965,7 @@ class MissingDependencyExcluder:
...
@@ -961,7 +965,7 @@ class MissingDependencyExcluder:
except
ImportError
:
except
ImportError
:
self
.
exclude_matchers
.
append
(
matcher
)
self
.
exclude_matchers
.
append
(
matcher
)
self
.
tests_missing_deps
=
[]
self
.
tests_missing_deps
=
[]
def
__call__
(
self
,
testname
):
def
__call__
(
self
,
testname
,
tags
=
None
):
for
matcher
in
self
.
exclude_matchers
:
for
matcher
in
self
.
exclude_matchers
:
if
matcher
(
testname
):
if
matcher
(
testname
):
self
.
tests_missing_deps
.
append
(
testname
)
self
.
tests_missing_deps
.
append
(
testname
)
...
@@ -977,7 +981,7 @@ class VersionDependencyExcluder:
...
@@ -977,7 +981,7 @@ class VersionDependencyExcluder:
if
compare
(
version_info
,
ver
):
if
compare
(
version_info
,
ver
):
self
.
exclude_matchers
.
append
(
matcher
)
self
.
exclude_matchers
.
append
(
matcher
)
self
.
tests_missing_deps
=
[]
self
.
tests_missing_deps
=
[]
def
__call__
(
self
,
testname
):
def
__call__
(
self
,
testname
,
tags
=
None
):
for
matcher
in
self
.
exclude_matchers
:
for
matcher
in
self
.
exclude_matchers
:
if
matcher
(
testname
):
if
matcher
(
testname
):
self
.
tests_missing_deps
.
append
(
testname
)
self
.
tests_missing_deps
.
append
(
testname
)
...
@@ -997,9 +1001,38 @@ class FileListExcluder:
...
@@ -997,9 +1001,38 @@ class FileListExcluder:
finally
:
finally
:
f
.
close
()
f
.
close
()
def
__call__
(
self
,
testname
):
def
__call__
(
self
,
testname
,
tags
=
None
):
print
testname
return
testname
in
self
.
excludes
or
testname
.
split
(
'.'
)[
-
1
]
in
self
.
excludes
return
testname
in
self
.
excludes
or
testname
.
split
(
'.'
)[
-
1
]
in
self
.
excludes
class
TagsSelector
:
def
__init__
(
self
,
tag
,
value
):
self
.
tag
=
tag
self
.
value
=
value
def
__call__
(
self
,
testname
,
tags
=
None
):
if
tags
is
None
:
return
False
else
:
return
self
.
value
in
tags
[
self
.
tag
]
class
RegExSelector
:
def
__init__
(
self
,
pattern_string
):
self
.
pattern
=
re
.
compile
(
pattern_string
,
re
.
I
|
re
.
U
)
def
__call__
(
self
,
testname
,
tags
=
None
):
return
self
.
pattern
.
search
(
testname
)
def
string_selector
(
s
):
ix
=
s
.
find
(
':'
)
if
ix
==
-
1
:
return
RegExSelector
(
s
)
else
:
return
TagsSelector
(
s
[:
ix
],
s
[
ix
+
1
:])
def
refactor_for_py3
(
distdir
,
cy3_dir
):
def
refactor_for_py3
(
distdir
,
cy3_dir
):
# need to convert Cython sources first
# need to convert Cython sources first
import
lib2to3.refactor
import
lib2to3.refactor
...
@@ -1239,9 +1272,9 @@ def main():
...
@@ -1239,9 +1272,9 @@ def main():
test_bugs
=
True
test_bugs
=
True
import
re
import
re
selectors
=
[
re
.
compile
(
r
,
re
.
I
|
re
.
U
).
search
for
r
in
cmd_args
]
selectors
=
[
string_selector
(
r
)
for
r
in
cmd_args
]
if
not
selectors
:
if
not
selectors
:
selectors
=
[
lambda
x
:
True
]
selectors
=
[
lambda
x
,
tags
=
None
:
True
]
# Chech which external modules are not present and exclude tests
# Chech which external modules are not present and exclude tests
# which depends on them (by prefix)
# which depends on them (by prefix)
...
@@ -1251,7 +1284,7 @@ def main():
...
@@ -1251,7 +1284,7 @@ def main():
exclude_selectors
=
[
missing_dep_excluder
,
version_dep_excluder
]
# want to pring msg at exit
exclude_selectors
=
[
missing_dep_excluder
,
version_dep_excluder
]
# want to pring msg at exit
if
options
.
exclude
:
if
options
.
exclude
:
exclude_selectors
+=
[
re
.
compile
(
r
,
re
.
I
|
re
.
U
).
search
for
r
in
options
.
exclude
]
exclude_selectors
+=
[
string_selector
(
r
)
for
r
in
options
.
exclude
]
if
not
test_bugs
:
if
not
test_bugs
:
exclude_selectors
+=
[
FileListExcluder
(
os
.
path
.
join
(
ROOTDIR
,
"bugs.txt"
))
]
exclude_selectors
+=
[
FileListExcluder
(
os
.
path
.
join
(
ROOTDIR
,
"bugs.txt"
))
]
...
...
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