summaryrefslogtreecommitdiffstats
path: root/Lib/test/regrtest.py
diff options
context:
space:
mode:
authorÉric Araujo <merwok@netwok.org>2011-11-06 06:01:18 (GMT)
committerÉric Araujo <merwok@netwok.org>2011-11-06 06:01:18 (GMT)
commit4e377f215d1b4ec7a7a7268a1d4cbd867a45a9ee (patch)
treebc58b37cb41ed793f2654a1a612af2a7035bd985 /Lib/test/regrtest.py
parent8e5d7cbca13f47489c1c70a06e1107cbf3264c4e (diff)
downloadcpython-4e377f215d1b4ec7a7a7268a1d4cbd867a45a9ee.zip
cpython-4e377f215d1b4ec7a7a7268a1d4cbd867a45a9ee.tar.gz
cpython-4e377f215d1b4ec7a7a7268a1d4cbd867a45a9ee.tar.bz2
Make sure packaging tests that register custom commands also clear them
Diffstat (limited to 'Lib/test/regrtest.py')
-rwxr-xr-xLib/test/regrtest.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/Lib/test/regrtest.py b/Lib/test/regrtest.py
index bbda525..9fe7bba 100755
--- a/Lib/test/regrtest.py
+++ b/Lib/test/regrtest.py
@@ -172,6 +172,7 @@ import io
import json
import logging
import os
+import packaging.command
import packaging.database
import platform
import random
@@ -967,7 +968,7 @@ class saved_test_environment:
'sys.warnoptions', 'threading._dangling',
'multiprocessing.process._dangling',
'sysconfig._CONFIG_VARS', 'sysconfig._SCHEMES',
- 'packaging.database_caches',
+ 'packaging.command._COMMANDS', 'packaging.database_caches',
)
def get_sys_argv(self):
@@ -1055,6 +1056,22 @@ class saved_test_environment:
# Can't easily revert the logging state
pass
+ def get_packaging_command__COMMANDS(self):
+ # registry mapping command names to full dotted path or to the actual
+ # class (resolved on demand); this check only looks at the names, not
+ # the types of the values (IOW, if a value changes from a string
+ # (dotted path) to a class it's okay but if a key (i.e. command class)
+ # is added we complain)
+ id_ = id(packaging.command._COMMANDS)
+ keys = set(packaging.command._COMMANDS)
+ return id_, keys
+ def restore_packaging_command__COMMANDS(self, saved):
+ # if command._COMMANDS was bound to another dict obhect, we can't
+ # restore the previous object and contents, because the get_ method
+ # above does not return the dict object (to ignore changes in values)
+ for key in packaging.command._COMMANDS.keys() - saved[1]:
+ del packaging.command._COMMANDS[key]
+
def get_packaging_database_caches(self):
# caching system used by the PEP 376 implementation
# we have one boolean and four dictionaries, initially empty