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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the testing guide within the development guide #1163

Merged
merged 65 commits into from
Sep 8, 2021

Conversation

namurphy
Copy link
Member

@namurphy namurphy commented Jun 2, 2021

There are a couple of parts of our testing guide that have become out-of-date. For example, we no longer use Travis CI or AppVeyor. This PR is intended to update the testing guide to make it more up-to-date.

This is a companion pull request to #1156.

@github-actions github-actions bot added the docs PlasmaPy Docs at http://docs.plasmapy.org label Jun 2, 2021
@codecov
Copy link

codecov bot commented Jun 2, 2021

Codecov Report

❗ No coverage uploaded for pull request base (main@cf3576c). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1163   +/-   ##
=======================================
  Coverage        ?   97.06%           
=======================================
  Files           ?       73           
  Lines           ?     7093           
  Branches        ?        0           
=======================================
  Hits            ?     6885           
  Misses          ?      208           
  Partials        ?        0           

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 cf3576c...6eaca71. Read the comment docs.

@namurphy namurphy added this to the 0.7.0 milestone Jul 13, 2021
@namurphy
Copy link
Member Author

namurphy commented Jul 13, 2021

I'd like to finish this for 0.7.0 so I tentatively marked that milestone, but I'll probably need to limit the scope of this PR and make updates for 0.8.0 in a separate PR.

@namurphy namurphy modified the milestones: 0.7.0, 0.8.0 Jul 26, 2021
Copy link
Member

@StanczakDominik StanczakDominik left a comment

Choose a reason for hiding this comment

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

This honestly LGTM. Added a single fix to the style check guide.

Also, black is not quite pep8.

docs/development/testing_guide.rst Outdated Show resolved Hide resolved
@namurphy
Copy link
Member Author

namurphy commented Jul 27, 2021

So I don't forget from today's community meeting...

  • Add a subsection on running tests with pytest. Mention that it is faster, is less resource intensive, and has less computational overhead. Mention that it is recommended for running tests locally
  • Add a subsection on running tests with tox. Mention that it's less effort to run since you don't have to set up an environment, but that because it creates a virtual environment, the tests take longer to run. Mention that it is well-suited for CI because of that.
  • Remove python setup.py test.

@StanczakDominik StanczakDominik self-requested a review September 7, 2021 18:31
@StanczakDominik StanczakDominik self-assigned this Sep 7, 2021
Copy link
Member

@StanczakDominik StanczakDominik left a comment

Choose a reason for hiding this comment

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

Looks good! A couple minor suggestions and ideas, but I'd be happy to have it merged as is.

docs/development/testing_guide.rst Outdated Show resolved Hide resolved
docs/development/testing_guide.rst Outdated Show resolved Hide resolved
docs/development/testing_guide.rst Outdated Show resolved Hide resolved
docs/development/testing_guide.rst Outdated Show resolved Hide resolved
* Use the ``--pdb`` flag to enter the `Python debugger`_ upon test
failures.

Using tox
Copy link
Member

Choose a reason for hiding this comment

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

There was some package I saw that had a similar section in their documentation. It went like this:


Using tox

Use tox for testing. Tox has many flags.


docs/development/testing_guide.rst Outdated Show resolved Hide resolved
Comment on lines 259 to 260
Types of tests
==============
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we could move this section into a subpage, so we can direct new contributors here, but still give them the option of a deeper dive?

docs/development/testing_guide.rst Outdated Show resolved Hide resolved
Comment on lines +598 to +599
Best practices
==============
Copy link
Member

Choose a reason for hiding this comment

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

Maybe unintuitively, but I think this is completely fine to keep here, as opposed to the previous section where you asked this question. It's a great summary that should leave people with a sense of not just knowing how to mechanically implement tests, but also how to... strategically approach them? The testing metagame, if you excuse my lack of better phrase at the moment?

Comment on lines +629 to +631
@pytest.mark.slow
def test_calculating_primes():
calculate_all_primes()
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be parametrized somehow? 😜

namurphy and others added 4 commits September 8, 2021 08:50
Co-authored-by: Dominik Stańczak <[email protected]>
Co-authored-by: Dominik Stańczak <[email protected]>
@namurphy
Copy link
Member Author

namurphy commented Sep 8, 2021

pre-commit.ci autofix

@namurphy
Copy link
Member Author

namurphy commented Sep 8, 2021

@etjohnson and @StanczakDominik — Thank you for the helpful reviews!

My main changes were implementing most or all the changes that you suggested, revising the section on running different tox test environments, moving the definitions of unit & integration tests to the glossary page, and adding an image that shows the GitHub Actions checks. We could expand the discussion on fixtures in another pull request if we'd like.

Thank you again!

@namurphy namurphy enabled auto-merge (squash) September 8, 2021 18:59
@namurphy namurphy merged commit 6055cac into PlasmaPy:main Sep 8, 2021
@namurphy namurphy deleted the test-guide-update branch September 10, 2021 00:57
Tlord18 pushed a commit to Tlord18/PlasmaPy that referenced this pull request Oct 6, 2021
* Update testing guide in development guide

* Add pytest to intersphinx

* Update testing guide

* Add changelog entry

* Minor updates to testing guide

* Retitle testing guide

* Update docs/development/testing_guide.rst

Co-authored-by: Dominik Stańczak <[email protected]>

* Rearrange test guide

* Update preamble for testing guide

* Updates to testing guide

* Minor updates to testing guide

* Remove run_test section

* Add link to create an issue to update testing guide

* Add to common links

* Update testing guide

* More updates to testing guide

* Update list of testing best practices

* Apply suggestions from code review

Co-authored-by: Dominik Stańczak <[email protected]>

* Revise testing guide

* Fix duplicate links and reST problems

* Update testing guide

* Update testing guide

* Use in-line link

* Update code coverage section

* Fix placement of comment to ignore func in coverage tests

* Update code coverage section

* Add unit & integration testing to glossary

* Fix spacing in math with units example

* Update testing guide

* Update testing guidelines

* Add and update bibliography.rst

* Update sections on unit & integration testing

* Update testing best practices

* Delete commented out text

The text removed here may be worth revisiting if this section were to
be revised.

* Delete commented out text

The text removed here may be worth revisiting if this section were to
be revised.

* Put bibliography entries back into testing guide

To avoid having this pull request about multiple things, I decided to
hold off on the new bibliography page. In particular, I was thinking
that the pull request that adds the bibliography should also include
edits to the section of doc_guide.rst that describes how to do
references.

* Minor updates to testing guide

* Fix reference

* Use common links for black and isort

* Fix reST error & broken link

* Update changelog entry

* Add Wilson2014 reference

* Future proof the docs

* Clarify reasons for dev test failures

Co-authored-by: Dominik Stańczak <[email protected]>

* Improve grammar

Co-authored-by: Dominik Stańczak <[email protected]>

* Update docs/development/testing_guide.rst

Co-authored-by: Dominik Stańczak <[email protected]>

* Improve discussion of fixtures

Co-authored-by: Dominik Stańczak <[email protected]>

* Update discussion on running slow tests

Co-authored-by: Dominik Stańczak <[email protected]>

* Update common links & use them in index.rst

* Move unit/integration test defs to glossary

* Add image for results of pull request checks

* Add image of pull request checks

* Fix image path

* Update text around image of pull request checks

* Suggest using assert_allclose & astropy equivalent

* Revamp section on running tests with tox

Co-authored-by: Dominik Stańczak <[email protected]>
Tlord18 pushed a commit to Tlord18/PlasmaPy that referenced this pull request Oct 6, 2021
* Update testing guide in development guide

* Add pytest to intersphinx

* Update testing guide

* Add changelog entry

* Minor updates to testing guide

* Retitle testing guide

* Update docs/development/testing_guide.rst

Co-authored-by: Dominik Stańczak <[email protected]>

* Rearrange test guide

* Update preamble for testing guide

* Updates to testing guide

* Minor updates to testing guide

* Remove run_test section

* Add link to create an issue to update testing guide

* Add to common links

* Update testing guide

* More updates to testing guide

* Update list of testing best practices

* Apply suggestions from code review

Co-authored-by: Dominik Stańczak <[email protected]>

* Revise testing guide

* Fix duplicate links and reST problems

* Update testing guide

* Update testing guide

* Use in-line link

* Update code coverage section

* Fix placement of comment to ignore func in coverage tests

* Update code coverage section

* Add unit & integration testing to glossary

* Fix spacing in math with units example

* Update testing guide

* Update testing guidelines

* Add and update bibliography.rst

* Update sections on unit & integration testing

* Update testing best practices

* Delete commented out text

The text removed here may be worth revisiting if this section were to
be revised.

* Delete commented out text

The text removed here may be worth revisiting if this section were to
be revised.

* Put bibliography entries back into testing guide

To avoid having this pull request about multiple things, I decided to
hold off on the new bibliography page. In particular, I was thinking
that the pull request that adds the bibliography should also include
edits to the section of doc_guide.rst that describes how to do
references.

* Minor updates to testing guide

* Fix reference

* Use common links for black and isort

* Fix reST error & broken link

* Update changelog entry

* Add Wilson2014 reference

* Future proof the docs

* Clarify reasons for dev test failures

Co-authored-by: Dominik Stańczak <[email protected]>

* Improve grammar

Co-authored-by: Dominik Stańczak <[email protected]>

* Update docs/development/testing_guide.rst

Co-authored-by: Dominik Stańczak <[email protected]>

* Improve discussion of fixtures

Co-authored-by: Dominik Stańczak <[email protected]>

* Update discussion on running slow tests

Co-authored-by: Dominik Stańczak <[email protected]>

* Update common links & use them in index.rst

* Move unit/integration test defs to glossary

* Add image for results of pull request checks

* Add image of pull request checks

* Fix image path

* Update text around image of pull request checks

* Suggest using assert_allclose & astropy equivalent

* Revamp section on running tests with tox

Co-authored-by: Dominik Stańczak <[email protected]>
@namurphy namurphy mentioned this pull request Aug 18, 2022
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor guide docs PlasmaPy Docs at http://docs.plasmapy.org
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants