Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: Remove astropy.test(), should use pytest directly #16208

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MridulS
Copy link
Contributor

@MridulS MridulS commented Mar 17, 2024

This PR addresses one of the points brought forward in #16177.

This removes astropy.test(), this does not deprecate/remove TestRunner. We can do a deprecation too (astropy.test()) if folks think this is a tad bit aggressive for downstream code 馃槄 . We can go down the sunpy route too and add a direct call to pytest.main from astropy.test but I would argue let's keep the testing separate from final user install. A user shouldn't really ever worry about installing a broken astropy wheel. It should be caught in the CI first! If a user is doing a source build install I think it's fair to assume they are comfortable with calling pytest directly from command line.

This is the first step towards removing TestRunner. There is a lot of code in TestRunner that hasn't been touched in 10 years and things will only keep on evolving in pytest to play maintenance catchup 馃槄

Copy link

Thank you for your contribution to Astropy! 馃寣 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

tox.ini Outdated Show resolved Hide resolved
@pllim pllim added this to the v6.1.0 milestone Mar 18, 2024
@pllim pllim added Refactoring API change PRs and issues that change an existing API, possibly requiring a deprecation period testing labels Mar 18, 2024
@pllim
Copy link
Member

pllim commented Mar 18, 2024

Thanks!

I think this still needs a change log, because we had advertised astropy.test() in RC testing in the past, for that one person who wonders why 6.1rc testing is different...

@pllim
Copy link
Member

pllim commented Mar 18, 2024

p.s. When requested changes are addressed, this also would need a "Extra CI" label.

docs/install.rst Outdated Show resolved Hide resolved
@saimn
Copy link
Contributor

saimn commented Mar 18, 2024

So this would imply that RC testing should be done with pytest --pyargs astropy ?

@MridulS
Copy link
Contributor Author

MridulS commented Mar 20, 2024

So this would imply that RC testing should be done with pytest --pyargs astropy ?

Yes, assuming all the paths are fine, this should work just fine. I tried this out with https://github.com/astropy/astropy/wiki/v6.0-RC-Testing and it worked fine with pytest --pyargs astropy --remote-data

Copy link
Contributor

@mhvk mhvk left a comment

Choose a reason for hiding this comment

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

A few small further comments...

``astropy.test()`` to prevent test runs from taking too long. These tests can
be run by ``astropy.test()`` by adding the ``remote_data='any'`` flag. Turn on
``pytest`` to prevent test runs from taking too long. These tests can
be run by ``pytest`` by adding the ``remote_data='any'`` flag. Turn on
Copy link
Contributor

Choose a reason for hiding this comment

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

This is doubled up. This line and l.308 should be combined into

be included by running ``pytest --remote-data=any``.


import astropy
astropy.test(package='time')
changes do not break existing code, by running the Astropy tests.
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bit out of date in general, since we now suggest to use tox. I'd either skip the example and go straight to For more details on... or, perhaps better, rewrite as,

   changes do not break existing code, by running the Astropy tests,
   e.g., by running::

      tox -e test

   For more details on running ...

@@ -108,11 +102,16 @@ Testing an Installed ``astropy``

{% if is_development %}

The easiest way to test if your installed version of ``astropy`` is running
correctly is to use the :ref:`astropy.test()` function::
To run tests after installing ``astropy`` we need to install ``pytest`` and
Copy link
Contributor

Choose a reason for hiding this comment

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

Here, the changes are good as is, since we've not installed from source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API change PRs and issues that change an existing API, possibly requiring a deprecation period Docs installation Refactoring testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants