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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Gwenaël Samain
cython
Commits
b355d4c9
Commit
b355d4c9
authored
Jan 01, 2008
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow selecting tests via RegExp
parent
78df7dc4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
runtests.py
runtests.py
+15
-5
No files found.
runtests.py
View file @
b355d4c9
...
...
@@ -15,9 +15,10 @@ INCLUDE_DIRS = os.getenv('INCLUDE', '').split(os.pathsep)
CFLAGS
=
os
.
getenv
(
'CFLAGS'
,
''
).
split
()
class
TestBuilder
(
object
):
def
__init__
(
self
,
rootdir
,
workdir
):
def
__init__
(
self
,
rootdir
,
workdir
,
selectors
):
self
.
rootdir
=
rootdir
self
.
workdir
=
workdir
self
.
selectors
=
selectors
def
build_suite
(
self
):
suite
=
unittest
.
TestSuite
()
...
...
@@ -25,18 +26,22 @@ class TestBuilder(object):
path
=
os
.
path
.
join
(
self
.
rootdir
,
filename
)
if
os
.
path
.
isdir
(
path
)
and
filename
in
TEST_DIRS
:
suite
.
addTest
(
self
.
handle_directory
(
path
,
filename
in
TEST_RUN_DIRS
))
self
.
handle_directory
(
path
,
filename
))
return
suite
def
handle_directory
(
self
,
path
,
run_module
):
def
handle_directory
(
self
,
path
,
context
):
suite
=
unittest
.
TestSuite
()
for
filename
in
os
.
listdir
(
path
):
if
not
filename
.
endswith
(
".pyx"
):
continue
module
=
filename
[:
-
4
]
fqmodule
=
"%s.%s"
%
(
context
,
module
)
if
not
[
1
for
match
in
self
.
selectors
if
match
(
fqmodule
)
]:
continue
suite
.
addTest
(
CythonCompileTestCase
(
path
,
self
.
workdir
,
module
))
if
run_module
:
if
context
in
TEST_RUN_DIRS
:
suite
.
addTest
(
CythonRunTestCase
(
self
.
workdir
,
module
))
return
suite
...
...
@@ -105,5 +110,10 @@ if __name__ == '__main__':
if
not
os
.
path
.
exists
(
WORKDIR
):
os
.
makedirs
(
WORKDIR
)
tests
=
TestBuilder
(
ROOTDIR
,
WORKDIR
)
import
re
selectors
=
[
re
.
compile
(
r
,
re
.
I
).
search
for
r
in
sys
.
argv
[
1
:]
]
if
not
selectors
:
selectors
=
[
lambda
x
:
True
]
tests
=
TestBuilder
(
ROOTDIR
,
WORKDIR
,
selectors
)
unittest
.
TextTestRunner
(
verbosity
=
2
).
run
(
tests
.
build_suite
()
)
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