-
-
Couldn't load subscription status.
- Fork 170
MAINT: Add missing hooks tests. #653
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| """Test the numpydoc validate pre-commit hook.""" | ||
|
|
||
| import inspect | ||
| import sys | ||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
|
|
@@ -63,6 +64,8 @@ def test_validate_hook(example_module, config, capsys): | |
| numpydoc/tests/hooks/example_module.py:30: GL08 The object does not have a docstring | ||
| """ | ||
| ) | ||
| if sys.platform == "win32": | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another option could be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about replacing the occurrences of the hardcoded path with - numpydoc/tests/hooks/example_module.py
+ f'{str(example_module)}'As I understand it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both good ideas! My vote for now would be to get this in as-is with minimal changes to ensure that all the tests are being run, then tackle improvements to the test setup in a followup! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like @stefmolin's suggestion, this also clears the formatting much more. |
||
| expected = expected.replace("/", "\\") | ||
|
|
||
| return_code = run_hook([example_module], config=config) | ||
| assert return_code == 1 | ||
|
|
@@ -90,6 +93,8 @@ def test_validate_hook_with_ignore(example_module, capsys): | |
| numpydoc/tests/hooks/example_module.py:30: GL08 The object does not have a docstring | ||
| """ | ||
| ) | ||
| if sys.platform == "win32": | ||
| expected = expected.replace("/", "\\") | ||
|
|
||
| return_code = run_hook([example_module], ignore=["ES01", "SA01", "EX01"]) | ||
|
|
||
|
|
@@ -133,6 +138,8 @@ def test_validate_hook_with_toml_config(example_module, tmp_path, capsys): | |
| numpydoc/tests/hooks/example_module.py:30: GL08 The object does not have a docstring | ||
| """ | ||
| ) | ||
| if sys.platform == "win32": | ||
| expected = expected.replace("/", "\\") | ||
|
|
||
| return_code = run_hook([example_module], config=tmp_path) | ||
| assert return_code == 1 | ||
|
|
@@ -168,6 +175,8 @@ def test_validate_hook_with_setup_cfg(example_module, tmp_path, capsys): | |
| numpydoc/tests/hooks/example_module.py:30: GL08 The object does not have a docstring | ||
| """ | ||
| ) | ||
| if sys.platform == "win32": | ||
| expected = expected.replace("/", "\\") | ||
|
|
||
| return_code = run_hook([example_module], config=tmp_path) | ||
| assert return_code == 1 | ||
|
|
@@ -209,6 +218,8 @@ def test_validate_hook_exclude_option_pyproject(example_module, tmp_path, capsys | |
| numpydoc/tests/hooks/example_module.py:30: GL08 The object does not have a docstring | ||
| """ | ||
| ) | ||
| if sys.platform == "win32": | ||
| expected = expected.replace("/", "\\") | ||
|
|
||
| return_code = run_hook([example_module], config=tmp_path) | ||
| assert return_code == 1 | ||
|
|
@@ -242,6 +253,8 @@ def test_validate_hook_exclude_option_setup_cfg(example_module, tmp_path, capsys | |
| numpydoc/tests/hooks/example_module.py:17: PR07 Parameter "*args" has no description | ||
| """ | ||
| ) | ||
| if sys.platform == "win32": | ||
| expected = expected.replace("/", "\\") | ||
|
|
||
| return_code = run_hook([example_module], config=tmp_path) | ||
| assert return_code == 1 | ||
|
|
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This whole block edit could instead be
Anchor simplifies the addition of the drive and root, I believe.