-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[MRG+2] MAINT: Refactor the converted-image cache #7764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
1b24a16
650ddf2
3b5f636
556fd82
9f5a06d
33f2528
2136a26
6995a27
9ea66dd
3751f01
a70081e
85f54de
0d51e03
9de06c0
6007b37
e52cdd2
e5184bb
f47cbe4
996f22b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ | |
from nose.tools import raises | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
|
||
from matplotlib import cbook | ||
from matplotlib.testing.conversion_cache import ConversionCache, CacheError | ||
from matplotlib.testing._conversion_cache import _ConversionCache, _CacheError | ||
|
||
|
||
def test_cache_basic(): | ||
|
@@ -22,7 +22,7 @@ def test_cache_basic(): | |
def intmp(f): | ||
return os.path.join(tmpdir, f) | ||
try: | ||
cache = ConversionCache(intmp('cache')) | ||
cache = _ConversionCache(intmp('cache')) | ||
with open(intmp('fake.pdf'), 'w') as pdf: | ||
pdf.write('this is a fake pdf file') | ||
with open(intmp('fake.svg'), 'w') as svg: | ||
|
@@ -63,7 +63,7 @@ def test_cache_expire(): | |
def intmp(*f): | ||
return os.path.join(tmpdir, *f) | ||
try: | ||
cache = ConversionCache(intmp('cache'), 10) | ||
cache = _ConversionCache(intmp('cache'), 10) | ||
for i in range(5): | ||
filename = intmp('cache', 'file%d.png' % i) | ||
with open(filename, 'w') as f: | ||
|
@@ -95,9 +95,9 @@ def intmp(*f): | |
|
||
def test_cache_default_dir(): | ||
try: | ||
path = ConversionCache.get_cache_dir() | ||
path = _ConversionCache.get_cache_dir() | ||
assert path.endswith('test_cache') | ||
except CacheError: | ||
except _CacheError: | ||
pass | ||
|
||
|
||
|
@@ -107,7 +107,7 @@ def test_cache_default_dir(): | |
def test_cache_mkdir_error(mkdirs): | ||
tmpdir = tempfile.mkdtemp() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||
try: | ||
c = ConversionCache(os.path.join(tmpdir, 'cache')) | ||
c = _ConversionCache(os.path.join(tmpdir, 'cache')) | ||
finally: | ||
shutil.rmtree(tmpdir) | ||
|
||
|
@@ -120,6 +120,6 @@ def test_cache_unwritable_error(access): | |
cachedir = os.path.join(tmpdir, 'test_cache') | ||
try: | ||
cbook.mkdirs(cachedir) | ||
c = ConversionCache(cachedir) | ||
c = _ConversionCache(cachedir) | ||
finally: | ||
shutil.rmtree(tmpdir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we advocate for the use of a private class/function or just inform the user of its disappearance?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, removed the addenda.