Skip to content

Use symlinks instead of copies for test result_images.#10222

Merged
dstansby merged 1 commit into
matplotlib:masterfrom
anntzer:link
Jun 18, 2019
Merged

Use symlinks instead of copies for test result_images.#10222
dstansby merged 1 commit into
matplotlib:masterfrom
anntzer:link

Conversation

@anntzer

@anntzer anntzer commented Jan 10, 2018

Copy link
Copy Markdown
Contributor

PR Summary

This seems to shave a few minutes(!) from the CI.

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@tacaswell tacaswell closed this Jan 11, 2018
@tacaswell tacaswell reopened this Jan 11, 2018
@tacaswell

Copy link
Copy Markdown
Member

power-cycled to get the gdb fix.

@tacaswell tacaswell added this to the v2.2 milestone Jan 11, 2018
@jklymak

jklymak commented Jan 11, 2018

Copy link
Copy Markdown
Member

OK, but are these tests really any faster on CI? 15 minutes 37 sec for the 3.6 test doesn't seem any faster than other recent tests... https://travis-ci.org/matplotlib/matplotlib/builds/325962079?utm_source=github_status&utm_medium=notification took 14 minutes 50 seconds (as a completely non-scientific comparison).

@anntzer

anntzer commented Jan 11, 2018

Copy link
Copy Markdown
Contributor Author

Seems quite variable. Will probably try to accumulate some statistics on my side first...

Comment thread lib/matplotlib/testing/decorators.py Outdated
orig_expected_fname))
raise ImageComparisonFailure(reason)
try:
try: # os.symlink errors if the target already exists.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Better:

with contextlib.suppress(FileNotFoundError):
    os.remove(expected_fname)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sure

@timhoffm

Copy link
Copy Markdown
Member

What is the right way forward here? Should we try to verify the speed gain again? Should we drop this? Should we just accept on the basis that symlinking feels better and may even bring a performance gain (without test) and it's just slightly more complicated.

@WeatherGod

WeatherGod commented Jun 11, 2019 via email

Copy link
Copy Markdown
Member

@timhoffm

timhoffm commented Jun 11, 2019

Copy link
Copy Markdown
Member

You need privileges to symlink on Windows, which a regular user on Windows does not have (https://docs.python.org/3/library/os.html?highlight=symlink#os.symlink). This is covered in the code with the except OSError and copied instead. - Not sure what that means for NTFS under linux.

The code is not compatible with WindowsXP and earlier, as that would throw a NotImplementedError. Probably we don't have to worry about testing for XP, but one could check that as well and resort to copying again.

@anntzer

anntzer commented Jun 11, 2019

Copy link
Copy Markdown
Contributor Author

It feels better to use symlinks, although I have admittedly no numbers to show real improvements. I don't really care if this goes in or if we abandon it.
The OSError check will handle Windows just fine.

@timhoffm timhoffm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I've run the testsuite on master:

  • 610s as is
  • 565s with this patch

Using a PCI-E SSD, which should already be fast for file copying.

@dstansby dstansby left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems reasonable to me 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants