Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ca4bfce

Browse filesBrowse files
Fix broken symlinks for expected images on WSL
1 parent e7fd79f commit ca4bfce
Copy full SHA for ca4bfce

File tree

Expand file treeCollapse file tree

1 file changed

+8
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+8
-3
lines changed

‎lib/matplotlib/testing/decorators.py

Copy file name to clipboardExpand all lines: lib/matplotlib/testing/decorators.py
+8-3Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import functools
33
import inspect
44
import os
5+
from platform import uname
56
from pathlib import Path
67
import shutil
78
import string
@@ -134,10 +135,14 @@ def copy_baseline(self, baseline, extension):
134135
# os.symlink errors if the target already exists.
135136
with contextlib.suppress(OSError):
136137
os.remove(expected_fname)
137-
try:
138-
os.symlink(orig_expected_path, expected_fname)
139-
except OSError: # On Windows, symlink *may* be unavailable.
138+
if 'microsoft-standard' in uname().release:
139+
# On WSL, symlink breaks silently
140140
shutil.copyfile(orig_expected_path, expected_fname)
141+
else:
142+
try:
143+
os.symlink(orig_expected_path, expected_fname)
144+
except OSError: # On Windows, symlink *may* be unavailable.
145+
shutil.copyfile(orig_expected_path, expected_fname)
141146
except OSError as err:
142147
raise ImageComparisonFailure(
143148
f"Missing baseline image {expected_fname} because the "

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.