-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Throw DOC001 when docstring sections can't be parsed (numpy style) (#199
- Loading branch information
Showing
7 changed files
with
120 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# From: https://github.com/jsh9/pydoclint/issues/198 | ||
|
||
@pytest.fixture | ||
def setup_custom_logger(caplog: pytest.LogCaptureFixture) -> Generator[None]: | ||
""" | ||
Set up a custom logger. | ||
Parameters | ||
---------- | ||
caplog : pytest.LogCaptureFixture | ||
Pytest logging capture fixture. | ||
Yields | ||
------ | ||
None | ||
Yield to run test before cleanup. | ||
""" | ||
# Set class | ||
logging.setLoggerClass(CustomLogger) | ||
# Set new format | ||
format_copy = caplog.handler.formatter._fmt # type: ignore[union-attr] | ||
caplog.handler.setFormatter(logging.Formatter('%(id_string)s : %(message)s')) | ||
|
||
yield | ||
|
||
caplog.handler.setFormatter(logging.Formatter(format_copy)) | ||
# Reset logger class | ||
logging.setLoggerClass(logging.Logger) | ||
|
||
|
||
|
||
@pytest.fixture | ||
def setup_custom_logger2(caplog: pytest.LogCaptureFixture) -> Generator[None, None, None]: | ||
""" | ||
Set up a custom logger. | ||
Parameters | ||
---------- | ||
caplog : pytest.LogCaptureFixture | ||
Pytest logging capture fixture. | ||
Yields | ||
------ | ||
None | ||
Yield to run test before cleanup. | ||
""" | ||
# Set class | ||
logging.setLoggerClass(CustomLogger) | ||
# Set new format | ||
format_copy = caplog.handler.formatter._fmt # type: ignore[union-attr] | ||
caplog.handler.setFormatter(logging.Formatter('%(id_string)s : %(message)s')) | ||
|
||
yield | ||
|
||
caplog.handler.setFormatter(logging.Formatter(format_copy)) | ||
# Reset logger class | ||
logging.setLoggerClass(logging.Logger) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters