diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-08-16 00:32:47 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-08-16 00:32:47 (GMT) |
commit | 1e8a75414ff57ff8fa42d59d5717be9639c55b12 (patch) | |
tree | 0b934e748c268ede7d022369448bab0f2e401e98 /Lib | |
parent | c7ff21687f7da601ade74ec2d8a7682493a774bf (diff) | |
download | cpython-1e8a75414ff57ff8fa42d59d5717be9639c55b12.zip cpython-1e8a75414ff57ff8fa42d59d5717be9639c55b12.tar.gz cpython-1e8a75414ff57ff8fa42d59d5717be9639c55b12.tar.bz2 |
Merged revisions 84086 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84086 | antoine.pitrou | 2010-08-16 02:28:05 +0200 (lun., 16 août 2010) | 3 lines
Save and restore the global asyncore.socket_map, and warn if a test modified it
........
Diffstat (limited to 'Lib')
-rwxr-xr-x | Lib/test/regrtest.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py index 8a89a67..fae5fe5 100755 --- a/Lib/test/regrtest.py +++ b/Lib/test/regrtest.py @@ -761,7 +761,7 @@ class saved_test_environment: # the corresponding method names. resources = ('sys.argv', 'cwd', 'sys.stdin', 'sys.stdout', 'sys.stderr', - 'os.environ', 'sys.path') + 'os.environ', 'sys.path', 'asyncore.socket_map') def get_sys_argv(self): return id(sys.argv), sys.argv, sys.argv[:] @@ -802,6 +802,15 @@ class saved_test_environment: sys.path = saved_path[1] sys.path[:] = saved_path[2] + def get_asyncore_socket_map(self): + asyncore = sys.modules.get('asyncore') + return asyncore and asyncore.socket_map or {} + def restore_asyncore_socket_map(self, saved_map): + asyncore = sys.modules.get('asyncore') + if asyncore is not None: + asyncore.socket_map.clear() + asyncore.socket_map.update(saved_map) + def resource_info(self): for name in self.resources: method_suffix = name.replace('.', '_') |