Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gevent
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
Kirill Smelkov
gevent
Commits
ce84db39
Commit
ce84db39
authored
Jan 13, 2010
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test__doctests.py: test setup.py too
parent
82eff8f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
27 deletions
+37
-27
greentest/test__doctests.py
greentest/test__doctests.py
+37
-27
No files found.
greentest/test__doctests.py
View file @
ce84db39
...
...
@@ -2,39 +2,49 @@ import os
import
re
import
doctest
import
unittest
from
os.path
import
join
,
dirname
import
gevent
from
gevent
import
socket
base
=
os
.
path
.
dirname
(
gevent
.
__file__
)
modules
=
set
()
modules
.
add
((
'setup'
,
'setup.py'
))
def
myfunction
(
*
args
,
**
kwargs
):
pass
globs
=
{
'myfunction'
:
myfunction
,
'gevent'
:
gevent
,
'socket'
:
socket
}
for
path
,
dirs
,
files
in
os
.
walk
(
base
):
package
=
'gevent'
+
path
.
replace
(
base
,
''
).
replace
(
'/'
,
'.'
)
modules
.
add
((
package
,
os
.
path
.
join
(
path
,
'__init__.py'
)))
for
f
in
files
:
module
=
None
if
f
.
endswith
(
'.py'
):
module
=
f
[:
-
3
]
if
module
:
modules
.
add
((
package
+
'.'
+
module
,
os
.
path
.
join
(
path
,
f
)))
suite
=
unittest
.
TestSuite
()
tests_count
=
0
modules_count
=
0
for
m
,
path
in
modules
:
if
re
.
search
(
'^
\
s*>>>
'
, open(path).read(), re.M):
s = doctest.DocTestSuite(m, extraglobs=globs)
print '
%
s
(
from
%
s
):
%
s
tests
' % (m, path, len(s._tests))
suite.addTest(s)
modules_count += 1
tests_count += len(s._tests)
if
__name__
==
'__main__'
:
print '
Total
:
%
s
tests
in
%
s
modules
' % (tests_count, modules_count)
runner = unittest.TextTestRunner(verbosity=2)
runner.run(suite)
cwd
=
os
.
getcwd
()
try
:
base
=
dirname
(
gevent
.
__file__
)
print
base
os
.
chdir
(
join
(
base
,
'..'
))
globs
=
{
'myfunction'
:
myfunction
,
'gevent'
:
gevent
,
'socket'
:
socket
}
for
path
,
dirs
,
files
in
os
.
walk
(
base
):
package
=
'gevent'
+
path
.
replace
(
base
,
''
).
replace
(
'/'
,
'.'
)
modules
.
add
((
package
,
join
(
path
,
'__init__.py'
)))
for
f
in
files
:
module
=
None
if
f
.
endswith
(
'.py'
):
module
=
f
[:
-
3
]
if
module
:
modules
.
add
((
package
+
'.'
+
module
,
join
(
path
,
f
)))
suite
=
unittest
.
TestSuite
()
tests_count
=
0
modules_count
=
0
for
m
,
path
in
modules
:
if
re
.
search
(
'^
\
s*>>>
'
, open(path).read(), re.M):
s = doctest.DocTestSuite(m, extraglobs=globs)
print '
%
s
(
from
%
s
):
%
s
tests
' % (m, path, len(s._tests))
suite.addTest(s)
modules_count += 1
tests_count += len(s._tests)
print '
Total
:
%
s
tests
in
%
s
modules
' % (tests_count, modules_count)
runner = unittest.TextTestRunner(verbosity=2)
runner.run(suite)
finally:
os.chdir(cwd)
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