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

Add a new target 'doctest' to run doctests only and simplify Makefile #2443

Merged
merged 1 commit into from
Mar 23, 2023

Conversation

seisman
Copy link
Member

@seisman seisman commented Mar 20, 2023

Description of proposed changes

This is the first step to address #2286 (comment).

Changes in this PR:

  • Use Makefile's Target-specific Variable Values to simplify the Makefile targets related to tests. Now we have the _runtest target to run the tests. Other targets tests, fulltests, doctest, test_no_images all depend on the _runtest target. For each target, different values for PYTEST_ARGS are passed, so that different tests are execuated.
  • Add a doctest target which only runs the doctests, as suggested in Run full tests (including inline doctests) in workflows #2286 (comment)
  • Only generate coverage reports for the test target

To test this PR, you can run make <target> to see which tests run.

To save your time, you can simply add --collect-only (only collect the tests and don't run them) to pytest, i.e., changing line 37 to

cd $(TESTDIR); PYGMT_USE_EXTERNAL_DISPLAY="false" pytest --collect-only $(PYTEST_ARGS) --pyargs $(PROJECT)

Here are the counts of tests when I run these targets:

  • make test: 659
  • make fulltest: 696
  • make doctest: 68
  • make test_no_images: 696

Reminders

  • Run make format and make check to make sure the code follows the style guide.
  • Add tests for new features or tests that would have caught the bug that you're fixing.
  • Add new public functions/methods/classes to doc/api/index.rst.
  • Write detailed docstrings for all functions/methods.
  • If wrapping a new module, open a 'Wrap new GMT module' issue and submit reasonably-sized PRs.
  • If adding new functionality, add an example to docstrings or tutorials.
  • Use underscores (not hyphens) in names of Python files and directories.

Slash Commands

You can write slash commands (/command) in the first line of a comment to perform
specific operations. Supported slash commands are:

  • /format: automatically format and lint the code
  • /test-gmt-dev: run full tests on the latest GMT development version

@seisman seisman changed the title Add the doctests target and simplify Makefile Add a new target doctests target and simplify Makefile Mar 20, 2023
@seisman seisman changed the title Add a new target doctests target and simplify Makefile Add a new target 'doctest' to run doctests only and simplify Makefile Mar 20, 2023
@seisman seisman added the maintenance Boring but important stuff for the core devs label Mar 20, 2023
@seisman seisman added this to the 0.9.0 milestone Mar 20, 2023
@seisman seisman added the needs review This PR has higher priority and needs review. label Mar 20, 2023
Copy link
Contributor

@willschlitzer willschlitzer left a comment

Choose a reason for hiding this comment

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

I think this is a good change. I haven't worked with Makefiles, but the new syntax looks correct. Everything works on my computer.

@willschlitzer willschlitzer added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Mar 22, 2023
@seisman
Copy link
Member Author

seisman commented Mar 23, 2023

Ping @weiji14 do you have more comments on the changes?

Copy link
Member

@weiji14 weiji14 left a comment

Choose a reason for hiding this comment

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

Was just checking this out. Looks good!

@seisman seisman merged commit 3eabb99 into main Mar 23, 2023
@seisman seisman deleted the make-doctests branch March 23, 2023 09:29
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Boring but important stuff for the core devs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants