Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
76558e12
Commit
76558e12
authored
Oct 06, 2011
by
Éric Araujo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add regrtest check for caches in packaging.database (see #12167)
parent
1079bdfd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
Lib/test/regrtest.py
Lib/test/regrtest.py
+24
-0
No files found.
Lib/test/regrtest.py
View file @
76558e12
...
...
@@ -173,6 +173,7 @@ import io
import
json
import
logging
import
os
import
packaging.database
import
platform
import
random
import
re
...
...
@@ -967,6 +968,7 @@ class saved_test_environment:
'sys.warnoptions', 'threading._dangling',
'multiprocessing.process._dangling',
'sysconfig._CONFIG_VARS', 'sysconfig._SCHEMES',
'packaging.database_caches',
)
def get_sys_argv(self):
...
...
@@ -1054,6 +1056,28 @@ class saved_test_environment:
# Can't easily revert the logging state
pass
def get_packaging_database_caches(self):
# caching system used by the PEP 376 implementation
# we have one boolean and four dictionaries, initially empty
switch = packaging.database._cache_enabled
saved = []
for name in ('_cache_name', '_cache_name_egg',
'_cache_path', '_cache_path_egg'):
cache = getattr(packaging.database, name)
saved.append((id(cache), cache, cache.copy()))
return switch, saved
def restore_packaging_database_caches(self, saved):
switch, saved_caches = saved
packaging.database._cache_enabled = switch
for offset, name in enumerate(('_cache_name', '_cache_name_egg',
'_cache_path', '_cache_path_egg')):
_, cache, items = saved_caches[offset]
# put back the same object in place
setattr(packaging.database, name, cache)
# now restore its items
cache.clear()
cache.update(items)
def get_sys_warnoptions(self):
return id(sys.warnoptions), sys.warnoptions, sys.warnoptions[:]
def restore_sys_warnoptions(self, saved_options):
...
...
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