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
Boxiang Sun
cython
Commits
01f5140e
Commit
01f5140e
authored
Apr 13, 2012
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply exclude selectors to unit- and doctests.
parent
db8add3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
runtests.py
runtests.py
+8
-4
No files found.
runtests.py
View file @
01f5140e
...
@@ -938,7 +938,7 @@ class CythonPyregrTestCase(CythonRunTestCase):
...
@@ -938,7 +938,7 @@ class CythonPyregrTestCase(CythonRunTestCase):
include_debugger = sys.version_info[:2] > (2, 5)
include_debugger = sys.version_info[:2] > (2, 5)
def collect_unittests(path, module_prefix, suite, selectors):
def collect_unittests(path, module_prefix, suite, selectors
, exclude_selectors
):
def file_matches(filename):
def file_matches(filename):
return filename.startswith("
Test
") and filename.endswith("
.
py
")
return filename.startswith("
Test
") and filename.endswith("
.
py
")
...
@@ -970,6 +970,8 @@ def collect_unittests(path, module_prefix, suite, selectors):
...
@@ -970,6 +970,8 @@ def collect_unittests(path, module_prefix, suite, selectors):
modulename = module_prefix + filepath[len(path)+1:].replace(os.path.sep, '.')
modulename = module_prefix + filepath[len(path)+1:].replace(os.path.sep, '.')
if not [ 1 for match in selectors if match(modulename) ]:
if not [ 1 for match in selectors if match(modulename) ]:
continue
continue
if [ 1 for match in exclude_selectors if match(modulename) ]:
continue
module = __import__(modulename)
module = __import__(modulename)
for x in modulename.split('.')[1:]:
for x in modulename.split('.')[1:]:
module = getattr(module, x)
module = getattr(module, x)
...
@@ -977,7 +979,7 @@ def collect_unittests(path, module_prefix, suite, selectors):
...
@@ -977,7 +979,7 @@ def collect_unittests(path, module_prefix, suite, selectors):
def collect_doctests(path, module_prefix, suite, selectors):
def collect_doctests(path, module_prefix, suite, selectors
, exclude_selectors
):
def package_matches(dirname):
def package_matches(dirname):
if dirname == 'Debugger' and not include_debugger:
if dirname == 'Debugger' and not include_debugger:
return False
return False
...
@@ -1005,6 +1007,8 @@ def collect_doctests(path, module_prefix, suite, selectors):
...
@@ -1005,6 +1007,8 @@ def collect_doctests(path, module_prefix, suite, selectors):
modulename = module_prefix + filepath[len(path)+1:].replace(os.path.sep, '.')
modulename = module_prefix + filepath[len(path)+1:].replace(os.path.sep, '.')
if not [ 1 for match in selectors if match(modulename) ]:
if not [ 1 for match in selectors if match(modulename) ]:
continue
continue
if [ 1 for match in exclude_selectors if match(modulename) ]:
continue
if 'in_gdb' in modulename:
if 'in_gdb' in modulename:
# These should only be imported from gdb.
# These should only be imported from gdb.
continue
continue
...
@@ -1549,10 +1553,10 @@ def main():
...
@@ -1549,10 +1553,10 @@ def main():
test_suite
=
unittest
.
TestSuite
()
test_suite
=
unittest
.
TestSuite
()
if
options
.
unittests
:
if
options
.
unittests
:
collect_unittests
(
UNITTEST_ROOT
,
UNITTEST_MODULE
+
"."
,
test_suite
,
selectors
)
collect_unittests
(
UNITTEST_ROOT
,
UNITTEST_MODULE
+
"."
,
test_suite
,
selectors
,
exclude_selectors
)
if
options
.
doctests
:
if
options
.
doctests
:
collect_doctests
(
UNITTEST_ROOT
,
UNITTEST_MODULE
+
"."
,
test_suite
,
selectors
)
collect_doctests
(
UNITTEST_ROOT
,
UNITTEST_MODULE
+
"."
,
test_suite
,
selectors
,
exclude_selectors
)
if
options
.
filetests
and
languages
:
if
options
.
filetests
and
languages
:
filetests
=
TestBuilder
(
ROOTDIR
,
WORKDIR
,
selectors
,
exclude_selectors
,
filetests
=
TestBuilder
(
ROOTDIR
,
WORKDIR
,
selectors
,
exclude_selectors
,
...
...
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