Skip to content

Do not merge! Travis: explicitely run optional tests and QT test for OSX - #3231

Closed
hmaarrfk wants to merge 14 commits into
scikit-image:masterfrom
hmaarrfk:travis_optional_test
Closed

hmaarrfk wants to merge 14 commits into
scikit-image:masterfrom
hmaarrfk:travis_optional_test

Conversation

@hmaarrfk

@hmaarrfk hmaarrfk commented Jun 28, 2018 •

Copy link
Copy Markdown
Member

This is being abbandonned in favour of 4 or 5 smaller PRs

Sorry for so many commits refractoring the tests. I know these PRs are the hardest to review since there can be silent failures. A previous PR of mine likely caused benefit 4. not to appear sooner.

These became necessary when trying to pull out the matplotlib dependency PR #3129. That PR is almost ready too, but I had to include these 50 line changes which I figured were easier to review as a separate PR.

The tests were refractored to remove much of the logic in how they are run.
I think this became easier to do when we stopped supporting python 2.7.
I find that too many if and else statements make things harder to read:

Noticeable benefits

  1. Added a OSX Python 3.6 build (python 3.7 is out now ;) )
  2. OSX also installs and tests Qt
  3. PyAMG is an optional dependency: it isn't treated as a special case anymore
  4. OSX wasn't really testing with optional dependencies. This hid a bug in the version of libpng that was installed in travis. I explicitly upgrade libpng in OSX now

Test and build steps:

  1. Compile
  2. Install
  3. Setup matplotlib (will be moved below in PR Remove matplotlib as a core dependency. #3129)
  4. Test with minimal
  5. Install additional dependencies and Qt
  6. Test again and report coverage
  7. Build docs (This didn't work if I tried to enable it in every branch, it complained that files already existed, maybe because of caching??)

Note, we probably should refractor appveyor to run the same steps.

Xref

Fixes #3131
Fixes #3084

For reviewers

(Don't remove the checklist below.)

  • Check that the PR title is short, concise, and will make sense 1 year
    later.
  • Check that new functions are imported in corresponding __init__.py.
  • Check that new features, API changes, and deprecations are mentioned in
    doc/release/release_dev.rst.
  • Consider backporting the PR with @meeseeksdev backport to v0.14.x

@hmaarrfk
hmaarrfk force-pushed the travis_optional_test branch from f429b95 to 079edd0 Compare June 29, 2018 00:30
@soupault soupault added 🔧 type: Maintenance Refactoring and maintenance of internals 🧐 Needs review labels Jun 29, 2018
@soupault soupault added this to the 0.15 milestone Jun 29, 2018
@hmaarrfk
hmaarrfk force-pushed the travis_optional_test branch from 079edd0 to 0c93324 Compare July 7, 2018 22:25
@codecov-io

codecov-io commented Jul 7, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #3231 into master will decrease coverage by 0.05%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #3231      +/-   ##
=========================================
- Coverage   86.75%   86.7%   -0.06%     
=========================================
  Files         339     339              
  Lines       27356   27356              
=========================================
- Hits        23734   23718      -16     
- Misses       3622    3638      +16
Impacted Files Coverage Δ
skimage/viewer/qt.py 25.71% <0%> (-62.86%) ⬇️
skimage/viewer/__init__.py 80% <0%> (-20%) ⬇️
skimage/restoration/tests/test_denoise.py 99.73% <0%> (+0.26%) ⬆️
skimage/segmentation/tests/test_random_walker.py 98.82% <0%> (+0.39%) ⬆️
skimage/draw/_random_shapes.py 97.89% <0%> (+1.05%) ⬆️
skimage/filters/tests/test_lpi_filter.py 89.58% <0%> (+2.08%) ⬆️
skimage/viewer/tests/test_tools.py 100% <0%> (+2.65%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d3b8b6c...ec40c7e. Read the comment docs.

@grlee77

grlee77 commented Jul 7, 2018

Copy link
Copy Markdown
Contributor

I looked through the commits here and it looks good to me. Running the tests twice with and without optional dependencies is nice for completeness as long as everything is still well within the CI time limits.

unfortunately it looks like the PyQt5 problem is still the same as before, though

@hmaarrfk

hmaarrfk commented Jul 8, 2018 via email

Copy link
Copy Markdown
Member Author

@hmaarrfk

hmaarrfk commented Jul 8, 2018

Copy link
Copy Markdown
Member Author

Something is wrong with the matplotlibrc file. For some reason, matplotlib is going back to qt4 and not qt5....

@hmaarrfk

hmaarrfk commented Jul 8, 2018

Copy link
Copy Markdown
Member Author

I stepped through the import process, apparently it was missing sip. Lets see what happens now.

@hmaarrfk

hmaarrfk commented Jul 8, 2018

Copy link
Copy Markdown
Member Author

@grlee77 it now works! Its probably because pyqt5 removed it's sip dependency.

@hmaarrfk

hmaarrfk commented Jul 8, 2018

Copy link
Copy Markdown
Member Author

FYI: @jni

@jni

jni commented Jul 8, 2018

Copy link
Copy Markdown
Member

You're running the full test suite twice per build now? I don't necessarily think this is a nice plan, as it will take longer for Travis to complete... (And it already takes a long time...)

@jni

jni commented Jul 8, 2018

Copy link
Copy Markdown
Member

I don't understand the sip discussion... So PyQt5 still depends on sip but they don't explicitly declare that dependency?

@hmaarrfk

hmaarrfk commented Jul 8, 2018

Copy link
Copy Markdown
Member Author

So before my first colossal commit fixing all the deprecation warnings and whatnot, the suite was run twice.
I removed that in favor of "optional dependencies" flag.

Unfortunately, when you merged in 2.7 deprecation, it was added back in, albeit in a superposition of states which collapsed into something we didn't intend: There was no install command the two test runs.

The tests only take about 5 minutes each. I agree it is long, but I have to see if the doctests are compatible without matplotlib. I didn't find a way to run "only the doctests without the actual tests". Maybe we can submit a request upstream for that feature?

On travis, compilation takes about 8 minutes (cythonizing takes about 2, and compiling the c code takes about 5).
This PR #3254 tries to parallelize the cythonize command a little bit.
Cythonizing now takes about 1.2 minutes, and hopefully ccache will be re-enabled making the compilation take no time most of the time.

What actually takes ALOT of time are the examples. Looking into parallelizing them, but I'm not sure what happens to the return code.

We are getting close to the 50 minute limit. Travis has 2 cores though and we should be able to see a speedup improvement if we use all 2.

I tried to parallelize the tests (see pytest xdist) but the tiffle doctest don't parallelize well. Maybe I'll just patch up those tests. One test relies on a file created in a previous one....

@hmaarrfk

hmaarrfk commented Jul 8, 2018

Copy link
Copy Markdown
Member Author

Apparently there is a "new-first" option in pytests.
I'll have to explore it https://docs.pytest.org/en/latest/changelog.html#id64

@hmaarrfk
hmaarrfk force-pushed the travis_optional_test branch from acfac66 to ec9a04b Compare July 20, 2018 19:52
@hmaarrfk

Copy link
Copy Markdown
Member Author

Ok the SIP issue was actually a Matplotlib, and not a qtpy issue that was fixed in this Commit:
matplotlib/matplotlib@260e6d6#diff-025508b6963efcfa97ba27389f2d2b86

I guess we have to wait until it gets pushed upstream.

@hmaarrfk
hmaarrfk force-pushed the travis_optional_test branch 3 times, most recently from b6b43bf to b4f41bf Compare August 6, 2018 03:32
@hmaarrfk
hmaarrfk force-pushed the travis_optional_test branch from b4f41bf to cd365be Compare August 6, 2018 03:42
@hmaarrfk
hmaarrfk force-pushed the travis_optional_test branch from 8e6a5a6 to ec40c7e Compare August 6, 2018 04:25
@hmaarrfk

hmaarrfk commented Aug 6, 2018

Copy link
Copy Markdown
Member Author

@jni, I would like to get the ball rolling on this one before travis breaks again. Actually the matplotlib PR #3129 passed, but I would like to harden the build before we review that PR. It contains a subset of the modifications I made here.

You had an outstanding issue which was running the tests twice. You are right in that it takes more time to run the tests twice, but I think the main thing that takes time is the examples.

Those take a long time even on my machine.

I decided to actually create 2 linux builds just for the examples. (The OSX machines seems to finish in under 30 mins, so I think we have room to spare there).

Let me know what you think.

Note: Maybe cancel some of my previous builds on travis if you see this in time.

@hmaarrfk

hmaarrfk commented Aug 6, 2018

Copy link
Copy Markdown
Member Author

@jni seems like my assumptions about the examples taking time was wrong. 😸

Oh well, at least what is on a table seems to run each build in under 30 mins.

@hmaarrfk hmaarrfk changed the title Travis: explicitely run optional tests and QT test for OSX Do not merge! Travis: explicitely run optional tests and QT test for OSX Sep 28, 2018
@hmaarrfk hmaarrfk closed this Sep 30, 2018
@hmaarrfk
hmaarrfk deleted the travis_optional_test branch November 4, 2018 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🧐 Needs review 🔧 type: Maintenance Refactoring and maintenance of internals

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants