Repository navigation
Update the test runner to use the updated code in astropy 1.3 - #1983
Conversation
|
Hello @Cadair! Thanks for updating the PR.
Comment last updated on May 26, 2018 at 11:19 Hours UTC |
|
there is a lot more todo on this, for some reason the doctests are not being picked up by pytest. Also I am working on porting the extra plugins for pytest that astropy uses to provide things like open file checking into a form where we can use them (see astropy/astropy#5770). Oh and it just fails, so that needs fixing as well. |
|
I will close this for now, there may be a couple of different ways of achieving it, like using the new code I wrote in Astropy to expose our current pytest UI. |
|
This should now be resurrected as since this was closed we have adopted doctestplus and remote_data and all the astropy pytest plugins have been broken out into seperate packages, which should make this whole thing a lot easier. I think the largest challenge here is now the setup command, but it should be doable. |
| from sunpy.tests import main as self_test | ||
| from sunpy.tests.runner import SunPyTestRunner | ||
|
|
||
| self_test = SunPyTestRunner.make_test_runner_in(__path__[0]) |
There was a problem hiding this comment.
This needs to not be defined if ASTROPY_SETUP is true.
| return [] | ||
|
|
||
| @keyword(False) | ||
| def figure(self, figure, kwargs): |
There was a problem hiding this comment.
need to add a figure_only
| cmd_pre += pre | ||
| cmd_post += post | ||
|
|
||
| cmd = ('{cmd_pre}{0}; import {1.package_name}, sys; result = (' |
There was a problem hiding this comment.
need to make sure this list is upto date with the one in astropy.
|
Online test fails looks to be because of a dead NOAA server. @sunpy/sunpy-maintainers review please! |
| .hypothesis/ | ||
| .pytest_cache/ | ||
| sunpydata.sqlite | ||
| v/ |
| # Order of tests run in build stages | ||
| - python: 3.6 | ||
| stage: Initial tests | ||
| env: SETUP_CMD='test --coverage' |
There was a problem hiding this comment.
the same thing, it just uses the default value
There was a problem hiding this comment.
Oh that was the default value already. Nevermind.
| ... if database_entry.observation_time_start.month in [3,4,5]: | ||
| ... database.tag(database_entry, 'spring') | ||
| >>> database.tags | ||
| >>> database.tags # doctest: +SKIP |
There was a problem hiding this comment.
Why were these tests skipped?
| >>> import sunpy.data.sample # doctest: +REMOTE_DATA | ||
| >>> my_timeseries = ts.TimeSeries(sunpy.data.sample.GOES_XRS_TIMESERIES, source='XRS') # doctest: +REMOTE_DATA | ||
|
|
||
| .. doctest-skip-all |
There was a problem hiding this comment.
because they don't work!!
There was a problem hiding this comment.
BUT HOW? I THOUGHT IT PASSED ON TRAVIS.
WHY DO WE HAVE AN ENTIRE FILE THAT HAS NO WORKING TESTS?
There was a problem hiding this comment.
Yeah I have no idea how this was passing before! This file needs updating to fix the tests but this PR is not the time.
| >>> start = '2005/01/03' | ||
| >>> end = '2005/12/03' | ||
| >>> temp = hc.time_query(start, end, max_records=10) # doctest: +REMOTE_DATA | ||
| >>> temp = hc.time_query(start, end, max_records=10) # doctest: +REMOTE_DATA +SKIP |
There was a problem hiding this comment.
this one also needs user input.
| >>> from sunpy.net.helio import hec | ||
| >>> hc = hec.HECClient() # doctest: +REMOTE_DATA | ||
| >>> hc.make_table_list() # doctest: +REMOTE_DATA | ||
| >>> hc.make_table_list() # doctest: +REMOTE_DATA +SKIP |
There was a problem hiding this comment.
this one is real. It's just nonsense.
There was a problem hiding this comment.
oh that's it, this function needs user input, so it can't be run as a doctest.
|
The |
|
Assuming my rebase hasn't broken anything this is now good to go. Reviews please! |
This modifies our internal test runner (the thing that provides
sunpy.self_testandpython setup.py test) to be much closer to astropy's implementation. The differences between us and astropy now are the replacement of the astropyremote_dataargument withonlineandofflineand the addition of thefigureargument.This means we have many more options to
self_testandsetup.py testsuch as checking for open file handles, running pep8 checks etc.