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
d67b3123
Commit
d67b3123
authored
Sep 28, 2010
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make greentest read 'switch_expected' setting from patched_tests_setup.py
parent
8497ff6f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
4 deletions
+36
-4
greentest/greentest.py
greentest/greentest.py
+9
-2
greentest/patched_tests_setup.py
greentest/patched_tests_setup.py
+27
-2
No files found.
greentest/greentest.py
View file @
d67b3123
...
...
@@ -22,12 +22,14 @@
# package is named greentest, not test, so it won't be confused with test in stdlib
import
sys
import
unittest
from
unittest
import
TestCase
as
BaseTestCase
import
time
import
traceback
import
re
import
os
from
os.path
import
basename
,
splitext
import
gevent
from
patched_tests_setup
import
get_switch_expected
VERBOSE
=
sys
.
argv
.
count
(
'-v'
)
>
1
...
...
@@ -38,12 +40,17 @@ else:
DEBUG
=
False
class
TestCase
(
unittest
.
TestCase
):
class
TestCase
(
Base
TestCase
):
__timeout__
=
1
switch_expected
=
True
switch_expected
=
'default'
_switch_count
=
None
def
run
(
self
,
*
args
,
**
kwargs
):
if
self
.
switch_expected
==
'default'
:
self
.
switch_expected
=
get_switch_expected
(
self
.
fullname
)
return
BaseTestCase
.
run
(
self
,
*
args
,
**
kwargs
)
def
setUp
(
self
):
gevent
.
sleep
(
0
)
# switch at least once to setup signal handlers
hub
=
gevent
.
hub
.
get_hub
()
...
...
greentest/patched_tests_setup.py
View file @
d67b3123
...
...
@@ -3,12 +3,37 @@ import re
# By default, test cases are expected to switch and emit warnings if there was none
# If a test is found in this list, it's expected not to switch.
switch_not_expected
=
'''test_select.SelectTestCase.test_error_conditions
tests
=
'''test_select.SelectTestCase.test_error_conditions
test_ftplib.TestFTPClass.test_all_errors
test_ftplib.TestFTPClass.test_getwelcome
test_ftplib.TestFTPClass.test_sanitize
test_ftplib.TestFTPClass.test_set_pasv
test_ftplib.TestIPv6Environment.test_af'''
.
split
()
test_ftplib.TestIPv6Environment.test_af
test_socket.TestExceptions.testExceptionTree
test_socket.Urllib2FileobjectTest.testClose
test_socket.TestLinuxAbstractNamespace.testLinuxAbstractNamespace
test_socket.TestLinuxAbstractNamespace.testMaxName
test_socket.TestLinuxAbstractNamespace.testNameOverflow
test_socket.GeneralModuleTests.*
'''
tests
=
[
x
.
strip
().
replace
(
'
\
.
'
, '
\\
.
').replace('
*
', '
.
*
?
') for x in tests.split('
\
n
') if x.strip()]
tests = re.compile('
^%
s
$
' % '
|
'.join(tests))
def get_switch_expected(fullname):
"""
>>> get_switch_expected('
test_select
.
SelectTestCase
.
test_error_conditions
')
False
>>> get_switch_expected('
test_socket
.
GeneralModuleTests
.
testCrucialConstants
')
False
>>> get_switch_expected('
test_socket
.
SomeOtherTest
.
testHello
')
True
"""
if tests.match(fullname) is not None:
print fullname
return False
return True
disabled_tests = [
# uses signal module which does not work with gevent (use gevent.signal())
...
...
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