diff --git a/lib/matplotlib/testing/decorators.py b/lib/matplotlib/testing/decorators.py index d2203729b763..49ac4a1506f8 100644 --- a/lib/matplotlib/testing/decorators.py +++ b/lib/matplotlib/testing/decorators.py @@ -2,6 +2,7 @@ import functools import inspect import os +from platform import uname from pathlib import Path import shutil import string @@ -135,6 +136,8 @@ def copy_baseline(self, baseline, extension): with contextlib.suppress(OSError): os.remove(expected_fname) try: + if 'microsoft' in uname().release.lower(): + raise OSError # On WSL, symlink breaks silently os.symlink(orig_expected_path, expected_fname) except OSError: # On Windows, symlink *may* be unavailable. shutil.copyfile(orig_expected_path, expected_fname)