Skip to content

Conversation

@weiji14
Copy link
Member

@weiji14 weiji14 commented Dec 16, 2023

Description of proposed changes

Add a helper testing function which returns a pytest.mark.skipif mark that will skip certain unit tests when a package is not installed. This will be useful for skipping unit tests that require optional dependencies such as pyarrow (#2800).

This is adapted from pandas' internal skip_if_no function at https://github.com/pandas-dev/pandas/blob/v2.1.4/pandas/util/_test_decorators.py#L121. Added a unit test to ensure that a correct pytest mark is returned.

Addresses #2774 (comment)

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

Add a helper testing function which returns a pytest.mark.skipif mark that will skip certain unit tests when a package is not installed. This is adapted from pandas' internal skip_if_no function at https://github.com/pandas-dev/pandas/blob/v2.1.4/pandas/util/_test_decorators.py#L121. Added a unit test to ensure that a correct pytest mark is returned.
@weiji14 weiji14 added the maintenance Boring but important stuff for the core devs label Dec 16, 2023
@weiji14 weiji14 added this to the 0.11.0 milestone Dec 16, 2023
@weiji14 weiji14 self-assigned this Dec 16, 2023
@weiji14 weiji14 requested a review from seisman December 16, 2023 01:49
@weiji14 weiji14 marked this pull request as ready for review December 16, 2023 01:49
@weiji14 weiji14 enabled auto-merge (squash) December 16, 2023 03:27
@weiji14 weiji14 merged commit 638ce40 into main Dec 16, 2023
@weiji14 weiji14 deleted the pytest-mark/skip-if-no branch December 16, 2023 03:40
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.

3 participants