Skip to content

Use symlinks instead of copies for test result_images. #10222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 18, 2019

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jan 10, 2018

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
Member

power-cycled to get the gdb fix.

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

jklymak commented Jan 11, 2018

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
Copy link
Contributor Author

anntzer commented Jan 11, 2018

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

orig_expected_fname))
raise ImageComparisonFailure(reason)
try:
try: # os.symlink errors if the target already exists.
Copy link
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
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
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
Copy link
Member

WeatherGod commented Jun 11, 2019 via email

@timhoffm
Copy link
Member

timhoffm commented Jun 11, 2019

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
Copy link
Contributor Author

anntzer commented Jun 11, 2019

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.

Copy link
Member

@timhoffm timhoffm left a comment

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.

Copy link
Member

@dstansby dstansby left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me 👍

@dstansby dstansby merged commit e53cb0e into matplotlib:master Jun 18, 2019
@dstansby dstansby modified the milestones: needs sorting, v3.2.0 Jun 18, 2019
@anntzer anntzer deleted the link branch June 18, 2019 14:54
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