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
533aa388
Commit
533aa388
authored
Aug 24, 2018
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support test skipping also in run tests.
parent
b1f7ef11
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
4 deletions
+10
-4
runtests.py
runtests.py
+10
-4
No files found.
runtests.py
View file @
533aa388
...
@@ -65,6 +65,8 @@ except ImportError:
...
@@ -65,6 +65,8 @@ except ImportError:
try
:
try
:
from
unittest
import
SkipTest
from
unittest
import
SkipTest
except
ImportError
:
except
ImportError
:
class
SkipTest
(
Exception
):
# don't raise, only provided to allow except-ing it!
pass
def
skip_test
(
reason
):
def
skip_test
(
reason
):
print
(
"Skipping test: %s"
%
reason
)
print
(
"Skipping test: %s"
%
reason
)
else
:
else
:
...
@@ -1025,7 +1027,7 @@ class CythonCompileTestCase(unittest.TestCase):
...
@@ -1025,7 +1027,7 @@ class CythonCompileTestCase(unittest.TestCase):
newext = fixer(extension)
newext = fixer(extension)
if newext is EXCLUDE_EXT:
if newext is EXCLUDE_EXT:
return skip_test("Test '%s' excluded due to tags '%s'" % (
return skip_test("Test '%s' excluded due to tags '%s'" % (
self.name, ', '.join(self.tags)))
self.name, ', '.join(self.tags
.get('tag', '')
)))
extension = newext or extension
extension = newext or extension
if self.language == 'cpp':
if self.language == 'cpp':
extension.language = 'c++'
extension.language = 'c++'
...
@@ -1174,7 +1176,7 @@ class CythonRunTestCase(CythonCompileTestCase):
...
@@ -1174,7 +1176,7 @@ class CythonRunTestCase(CythonCompileTestCase):
try:
try:
self.success = False
self.success = False
ext_so_path = self.runCompileTest()
ext_so_path = self.runCompileTest()
failures, errors
= len(result.failures), len(result.errors
)
failures, errors
, skipped = len(result.failures), len(result.errors), len(result.skipped
)
if not self.cython_only and ext_so_path is not None:
if not self.cython_only and ext_so_path is not None:
self.run_tests(result, ext_so_path)
self.run_tests(result, ext_so_path)
if failures == len(result.failures) and errors == len(result.errors):
if failures == len(result.failures) and errors == len(result.errors):
...
@@ -1182,6 +1184,9 @@ class CythonRunTestCase(CythonCompileTestCase):
...
@@ -1182,6 +1184,9 @@ class CythonRunTestCase(CythonCompileTestCase):
self.success = True
self.success = True
finally:
finally:
check_thread_termination()
check_thread_termination()
except SkipTest as exc:
result.addSkip(self, str(exc))
result.stopTest(self)
except Exception:
except Exception:
result.addError(self, sys.exc_info())
result.addError(self, sys.exc_info())
result.stopTest(self)
result.stopTest(self)
...
@@ -1363,17 +1368,18 @@ class PartialTestResult(_TextTestResult):
...
@@ -1363,17 +1368,18 @@ class PartialTestResult(_TextTestResult):
def data(self):
def data(self):
self.strip_error_results(self.failures)
self.strip_error_results(self.failures)
self.strip_error_results(self.errors)
self.strip_error_results(self.errors)
return (self.failures, self.errors, self.testsRun,
return (self.failures, self.errors, self.
skipped, self.
testsRun,
self.stream.getvalue())
self.stream.getvalue())
def join_results(result, data):
def join_results(result, data):
"""
Static
method
for
merging
the
result
back
into
the
main
"""
Static
method
for
merging
the
result
back
into
the
main
result
object
.
result
object
.
"""
"""
failures, errors, tests_run, output = data
failures, errors,
skipped,
tests_run, output = data
if output:
if output:
result.stream.write(output)
result.stream.write(output)
result.errors.extend(errors)
result.errors.extend(errors)
result.skipped.extend(skipped)
result.failures.extend(failures)
result.failures.extend(failures)
result.testsRun += tests_run
result.testsRun += tests_run
...
...
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