Skip to content

Update the test runner to use the updated code in astropy 1.3 - #1983

Merged
Cadair merged 5 commits into
sunpy:masterfrom
Cadair:test_runner
May 28, 2018
Merged

Cadair merged 5 commits into
sunpy:masterfrom
Cadair:test_runner

Conversation

@Cadair

@Cadair Cadair commented Feb 1, 2017

Copy link
Copy Markdown
Member

This modifies our internal test runner (the thing that provides sunpy.self_test and python setup.py test) to be much closer to astropy's implementation. The differences between us and astropy now are the replacement of the astropy remote_data argument with online and offline and the addition of the figure argument.

This means we have many more options to self_test and setup.py test such as checking for open file handles, running pep8 checks etc.

@Cadair Cadair added the Tests Affects tests in some measure. label Feb 1, 2017
@pep8speaks

pep8speaks commented Feb 1, 2017 •

Copy link
Copy Markdown

Hello @Cadair! Thanks for updating the PR.

Line 20:1: E303 too many blank lines (3)

Line 44:101: E501 line too long (130 > 100 characters)
Line 122:31: E128 continuation line under-indented for visual indent
Line 123:31: E128 continuation line under-indented for visual indent
Line 124:31: E128 continuation line under-indented for visual indent
Line 127:31: E128 continuation line under-indented for visual indent
Line 128:31: E128 continuation line under-indented for visual indent
Line 970:5: E122 continuation line missing indentation or outdented

Line 87:101: E501 line too long (144 > 100 characters)
Line 127:101: E501 line too long (107 > 100 characters)

Line 55:101: E501 line too long (110 > 100 characters)
Line 56:101: E501 line too long (111 > 100 characters)

Comment last updated on May 26, 2018 at 11:19 Hours UTC

@Cadair Cadair added Needs Review Needs review(s) before merge. [WIP] and removed Needs Review Needs review(s) before merge. labels Feb 1, 2017
@Cadair

Cadair commented Feb 9, 2017

Copy link
Copy Markdown
Member Author

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.

@Cadair

Cadair commented May 17, 2017

Copy link
Copy Markdown
Member Author

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.

@nabobalis nabobalis added the Needs Adoption PRs that went stale but should be picked up again and completed. label Apr 12, 2018
@Cadair

Cadair commented May 10, 2018

Copy link
Copy Markdown
Member Author

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.

@Cadair Cadair reopened this May 10, 2018
@Cadair Cadair removed the Needs Adoption PRs that went stale but should be picked up again and completed. label May 10, 2018
@Cadair Cadair added this to the 1.0 milestone May 10, 2018
Comment thread sunpy/__init__.py Outdated
from sunpy.tests import main as self_test
from sunpy.tests.runner import SunPyTestRunner

self_test = SunPyTestRunner.make_test_runner_in(__path__[0])

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This needs to not be defined if ASTROPY_SETUP is true.

Comment thread sunpy/tests/runner.py
return []

@keyword(False)
def figure(self, figure, kwargs):

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

need to add a figure_only

cmd_pre += pre
cmd_post += post

cmd = ('{cmd_pre}{0}; import {1.package_name}, sys; result = ('

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

need to make sure this list is upto date with the one in astropy.

@Cadair

Cadair commented May 13, 2018

Copy link
Copy Markdown
Member Author

Online test fails looks to be because of a dead NOAA server.

@sunpy/sunpy-maintainers review please!

@Cadair Cadair added the Needs Review Needs review(s) before merge. label May 13, 2018
Comment thread .gitignore
.hypothesis/
.pytest_cache/
sunpydata.sqlite
v/

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.

What is this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

🤷‍♀️

Comment thread .travis.yml
# Order of tests run in build stages
- python: 3.6
stage: Initial tests
env: SETUP_CMD='test --coverage'

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.

So what does this run now?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

the same thing, it just uses the default value

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.

Oh that was the default value already. Nevermind.

Comment thread docs/guide/acquiring_data/database.rst Outdated
... if database_entry.observation_time_start.month in [3,4,5]:
... database.tag(database_entry, 'spring')
>>> database.tags
>>> database.tags # doctest: +SKIP

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.

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

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.

But why? :(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

because they don't work!!

@nabobalis nabobalis May 14, 2018 •

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.

BUT HOW? I THOUGHT IT PASSED ON TRAVIS.

WHY DO WE HAVE AN ENTIRE FILE THAT HAS NO WORKING TESTS?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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.

Comment thread sunpy/net/helio/hec.py
>>> 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

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.

Skip?! :(

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this one also needs user input.

Comment thread sunpy/net/helio/hec.py
>>> 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

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.

But my skip?!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this one is real. It's just nonsense.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

oh that's it, this function needs user input, so it can't be run as a doctest.

@Cadair

Cadair commented May 17, 2018

Copy link
Copy Markdown
Member Author

oh balls: https://travis-ci.org/sunpy/sunpy/jobs/378357403#L2557

The -k remote_data in the online build skips all the damn doctests

@Cadair

Cadair commented May 26, 2018

Copy link
Copy Markdown
Member Author

Assuming my rebase hasn't broken anything this is now good to go. Reviews please!

@nabobalis nabobalis 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.

Looks like python code.

@Cadair
Cadair merged commit dc48228 into sunpy:master May 28, 2018
@Cadair
Cadair deleted the test_runner branch May 28, 2018 12:38
@nabobalis nabobalis removed the Needs Review Needs review(s) before merge. label Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tests Affects tests in some measure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants