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
c2da6d1a
Commit
c2da6d1a
authored
Nov 03, 2010
by
Stefan Behnel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enable CPython doctesting of .py files in tests/run/
parent
cfb1d64a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
0 deletions
+35
-0
runtests.py
runtests.py
+35
-0
No files found.
runtests.py
View file @
c2da6d1a
...
...
@@ -191,6 +191,9 @@ class TestBuilder(object):
for
test
in
self
.
build_tests
(
test_class
,
path
,
workdir
,
module
,
expect_errors
):
suite
.
addTest
(
test
)
if
filename
.
endswith
(
'.py'
):
# additionally test file in real Python
suite
.
addTest
(
PureDoctestTestCase
(
module
,
os
.
path
.
join
(
path
,
filename
)))
return
suite
def
build_tests
(
self
,
test_class
,
path
,
workdir
,
module
,
expect_errors
):
...
...
@@ -499,6 +502,38 @@ class CythonRunTestCase(CythonCompileTestCase):
try
:
os
.
unlink
(
result_file
)
except
:
pass
class
PureDoctestTestCase
(
unittest
.
TestCase
):
def
__init__
(
self
,
module_name
,
module_path
):
self
.
module_name
=
module_name
self
.
module_path
=
module_path
unittest
.
TestCase
.
__init__
(
self
,
'run'
)
def
shortDescription
(
self
):
return
"running pure doctests in %s"
%
self
.
module_name
def
run
(
self
,
result
=
None
):
if
result
is
None
:
result
=
self
.
defaultTestResult
()
loaded_module_name
=
'pure_doctest__'
+
self
.
module_name
result
.
startTest
(
self
)
try
:
self
.
setUp
()
import
imp
m
=
imp
.
load_source
(
loaded_module_name
,
self
.
module_path
)
try
:
doctest
.
DocTestSuite
(
m
).
run
(
result
)
finally
:
del
m
if
loaded_module_name
in
sys
.
modules
:
del
sys
.
modules
[
loaded_module_name
]
except
Exception
:
result
.
addError
(
self
,
sys
.
exc_info
())
result
.
stopTest
(
self
)
try
:
self
.
tearDown
()
except
Exception
:
pass
is_private_field
=
re
.
compile
(
'^_[^_]'
).
match
...
...
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