Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit6d8bc9f

Browse files
committed
Use symlinks instead of copies for test result_images.
1 parenteca2854 commit6d8bc9f

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

‎lib/matplotlib/testing/decorators.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,18 @@ def copy_baseline(self, baseline, extension):
192192
os.path.join(self.result_dir,
193193
os.path.basename(orig_expected_fname)),
194194
'expected')
195-
ifos.path.exists(orig_expected_fname):
196-
shutil.copyfile(orig_expected_fname,expected_fname)
197-
else:
198-
reason= ("Do not have baseline image {} because this "
199-
"file does not exist: {}".format(expected_fname,
200-
orig_expected_fname))
201-
raiseImageComparisonFailure(reason)
195+
try:
196+
# os.symlink errors if the target already exists.
197+
withcontextlib.suppress(OSError):
198+
os.remove(expected_fname)
199+
try:
200+
os.symlink(orig_expected_fname,expected_fname)
201+
exceptOSError:# On Windows, symlink *may* be unavailable.
202+
shutil.copyfile(orig_expected_fname,expected_fname)
203+
exceptOSError:
204+
raiseImageComparisonFailure(
205+
f"Missing baseline image{expected_fname} because the "
206+
f"following file cannot be accessed:{orig_expected_fname}")
202207
returnexpected_fname
203208

204209
defcompare(self,idx,baseline,extension):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp