Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
mkdirs throws OSError
  • Loading branch information
jkseppan committed Feb 20, 2017
commit 3751f01f5ca0a10722a07b4664f39fae79bdb954
2 changes: 1 addition & 1 deletion lib/matplotlib/testing/_conversion_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def ensure_cache_dir(self):
if not os.path.exists(self.cachedir):
try:
cbook.mkdirs(self.cachedir)
except IOError as e:
except OSError as e:
raise _CacheError("Error creating cache directory %s: %s"
% (self.cachedir, str(e)))
if not os.access(self.cachedir, os.W_OK):
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test_cache_default_dir():

@raises(_CacheError)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use pytest.raises context manager instead of this decorator.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@mock.patch('matplotlib.testing._conversion_cache.cbook.mkdirs',
side_effect=IOError)
side_effect=OSError)
def test_cache_mkdir_error(mkdirs):
tmpdir = tempfile.mkdtemp()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use tmpdir as a parameter to use the pytest fixture.

try:
Expand Down