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
c69c5b9c
Commit
c69c5b9c
authored
Sep 15, 2012
by
Denis Bilenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove test_patched_*.py
it is not handled by test__monkey_patching.py
parent
f47950b8
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
0 additions
and
177 deletions
+0
-177
greentest/helper.py
greentest/helper.py
+0
-107
greentest/patched_test.py
greentest/patched_test.py
+0
-2
greentest/test_patched_asyncore.py
greentest/test_patched_asyncore.py
+0
-2
greentest/test_patched_ftplib.py
greentest/test_patched_ftplib.py
+0
-2
greentest/test_patched_httplib.py
greentest/test_patched_httplib.py
+0
-2
greentest/test_patched_httpservers.py
greentest/test_patched_httpservers.py
+0
-2
greentest/test_patched_queue.py
greentest/test_patched_queue.py
+0
-2
greentest/test_patched_select.py
greentest/test_patched_select.py
+0
-2
greentest/test_patched_signal.py
greentest/test_patched_signal.py
+0
-2
greentest/test_patched_smtplib.py
greentest/test_patched_smtplib.py
+0
-2
greentest/test_patched_socket.py
greentest/test_patched_socket.py
+0
-2
greentest/test_patched_socket_ssl.py
greentest/test_patched_socket_ssl.py
+0
-2
greentest/test_patched_ssl.py
greentest/test_patched_ssl.py
+0
-2
greentest/test_patched_subprocess.py
greentest/test_patched_subprocess.py
+0
-2
greentest/test_patched_telnetlib.py
greentest/test_patched_telnetlib.py
+0
-2
greentest/test_patched_threading.py
greentest/test_patched_threading.py
+0
-21
greentest/test_patched_threading_local.py
greentest/test_patched_threading_local.py
+0
-2
greentest/test_patched_timeout.py
greentest/test_patched_timeout.py
+0
-2
greentest/test_patched_urllib.py
greentest/test_patched_urllib.py
+0
-2
greentest/test_patched_urllib2.py
greentest/test_patched_urllib2.py
+0
-2
greentest/test_patched_urllib2_localnet.py
greentest/test_patched_urllib2_localnet.py
+0
-2
greentest/test_patched_urllib2net.py
greentest/test_patched_urllib2net.py
+0
-2
greentest/test_patched_wsgiref.py
greentest/test_patched_wsgiref.py
+0
-2
greentest/update_patched_tests.py
greentest/update_patched_tests.py
+0
-7
No files found.
greentest/helper.py
deleted
100644 → 0
View file @
f47950b8
import
sys
import
os
import
imp
import
tempfile
import
glob
from
pipes
import
quote
CHDIR
=
os
.
path
.
join
(
tempfile
.
gettempdir
(),
'gevent-test'
)
try
:
os
.
makedirs
(
CHDIR
)
except
EnvironmentError
:
pass
version
=
'%s.%s'
%
sys
.
version_info
[:
2
]
missing_modules
=
{
'test_smtplib'
:
[
'2.4'
,
'2.5'
],
'test_asyncore'
:
[
'2.4'
,
'2.5'
],
'test_telnetlib'
:
[
'2.4'
,
'2.5'
],
'test_httpservers'
:
[
'2.4'
,
'2.5'
],
'test_ftplib'
:
[
'2.4'
,
'2.5'
],
'test_wsgiref'
:
[
'2.4'
],
'test_socket_ssl'
:
[
'2.6'
,
'2.7'
,
'3.1'
,
'3.2'
],
'test_patched_urllib2_localnet.py'
:
[
'3.1'
,
'3.2'
],
'test_ssl'
:
[
'2.5'
],
}
class
ContainsAll
(
object
):
def
__contains__
(
self
,
item
):
return
True
def
patch_all
(
timeout
=
None
):
import
greentest
from
gevent
import
monkey
monkey
.
patch_all
(
aggressive
=
True
)
import
unittest
unittest
.
TestCase
=
greentest
.
TestCase
unittest
.
TestCase
.
check_totalrefcount
=
False
unittest
.
TestCase
.
error_fatal
=
False
if
timeout
is
not
None
:
unittest
.
TestCase
.
__timeout__
=
timeout
def
imp_find_dotted_module
(
name
):
"""imp.find_module with dotted names"""
path
=
None
for
x
in
name
.
split
(
'.'
):
result
=
imp
.
find_module
(
x
,
path
)
path
=
[
result
[
1
]]
return
result
def
prepare_stdlib_test
(
filename
,
assets
=
None
):
patch_all
(
timeout
=
20
)
import
test
try
:
if
sys
.
version_info
[
0
]
>=
3
:
from
test
import
support
as
test_support
else
:
from
test
import
test_support
except
ImportError
:
sys
.
stderr
.
write
(
'test.__file__ = %s
\
n
'
%
test
.
__file__
)
raise
test_support
.
use_resources
=
ContainsAll
()
name
=
os
.
path
.
splitext
(
os
.
path
.
basename
(
filename
))[
0
].
replace
(
'_patched'
,
''
)
os
.
environ
[
'__module_name__'
]
=
name
try
:
_f
,
_filename
,
_
=
imp_find_dotted_module
(
'test.%s'
%
name
)
except
:
if
version
in
missing_modules
.
get
(
name
,
[]):
sys
.
exit
(
0
)
sys
.
stderr
.
write
(
'Failed to import test.%s
\
n
'
%
name
)
raise
module_source
=
_f
.
read
()
from
patched_tests_setup
import
disable_tests_in_source
module_source
=
disable_tests_in_source
(
module_source
,
name
)
module_code
=
compile
(
module_source
,
_filename
,
'exec'
)
print
>>
sys
.
stderr
,
'Testing %s with monkey patching'
%
_filename
os
.
system
(
'cp %s %s'
%
(
quote
(
filename
),
quote
(
os
.
path
.
join
(
CHDIR
,
os
.
path
.
basename
(
filename
)))))
os
.
chdir
(
CHDIR
)
copy_assets
(
os
.
path
.
dirname
(
_filename
),
assets
)
return
module_code
def
copy_assets
(
directory
,
assets
):
if
assets
:
cwd
=
os
.
getcwd
()
os
.
chdir
(
directory
)
try
:
if
isinstance
(
assets
,
basestring
):
assets
=
glob
.
glob
(
assets
)
for
asset
in
assets
:
os
.
system
(
'cp -r %s %s'
%
(
quote
(
asset
),
quote
(
os
.
path
.
join
(
CHDIR
,
asset
))))
finally
:
os
.
chdir
(
cwd
)
def
run
(
filename
,
d
,
assets
=
None
):
exec
prepare_stdlib_test
(
filename
,
assets
)
in
d
greentest/patched_test.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_asyncore.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_ftplib.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
(),
'*.pem'
)
greentest/test_patched_httplib.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_httpservers.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_queue.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_select.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_signal.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_smtplib.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_socket.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_socket_ssl.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_ssl.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
(),
'*.pem'
)
greentest/test_patched_subprocess.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_telnetlib.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_threading.py
deleted
100644 → 0
View file @
f47950b8
import
helper
module
=
helper
.
prepare_stdlib_test
(
__file__
)
import
sys
import
subprocess
from
subprocess
import
Popen
as
_Popen
monkey_patch
=
'from gevent import monkey; monkey.patch_all()
\
n
\
n
'
class
MyPopen
(
_Popen
):
def
__init__
(
self
,
arg
,
*
args
,
**
kwargs
):
if
arg
[:
2
]
==
[
sys
.
executable
,
'-c'
]:
assert
len
(
arg
)
==
3
,
arg
arg
=
arg
[:
2
]
+
[
monkey_patch
+
arg
[
2
]]
_Popen
.
__init__
(
self
,
arg
,
*
args
,
**
kwargs
)
subprocess
.
Popen
=
MyPopen
exec
module
in
globals
()
greentest/test_patched_threading_local.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_timeout.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_urllib.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_urllib2.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_urllib2_localnet.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_urllib2net.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/test_patched_wsgiref.py
deleted
100644 → 0
View file @
f47950b8
import
helper
helper
.
run
(
__file__
,
globals
())
greentest/update_patched_tests.py
deleted
100644 → 0
View file @
f47950b8
import
os
import
glob
for
filename
in
glob
.
glob
(
'test_patched_*.py'
):
cmd
=
'cp patched_test.py %s'
%
filename
print
cmd
os
.
system
(
cmd
)
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