diff --git a/README.md b/README.md index ae74bd8..25f4dae 100644 --- a/README.md +++ b/README.md @@ -36,5 +36,9 @@ If your test is running in a Docker container, you have to install this plugin a If your tests are run from a subdirectory of the git repository, you have to set the `PYTEST_RUN_PATH` environment variable to the path of that directory relative to the repository root in order for GitHub to identify the files with errors correctly. +### Warning annotations + +This plugin also supports warning annotations when used with Pytest 6.0+. To disable warning annotations, pass `--exclude-warning-annotations` to pytest. + ## Screenshot [![Image from Gyazo](https://i.gyazo.com/b578304465dd1b755ceb0e04692a57d9.png)](https://gyazo.com/b578304465dd1b755ceb0e04692a57d9) diff --git a/plugin_test.py b/plugin_test.py index bd79941..df73cd6 100644 --- a/plugin_test.py +++ b/plugin_test.py @@ -139,7 +139,7 @@ def test_warning(): """ ) testdir.monkeypatch.setenv("GITHUB_ACTIONS", "true") - result = testdir.runpytest_subprocess("--exclude-warnings") + result = testdir.runpytest_subprocess("--exclude-warning-annotations") assert not result.stderr.lines diff --git a/pytest_github_actions_annotate_failures/plugin.py b/pytest_github_actions_annotate_failures/plugin.py index a563da0..cc16ae7 100644 --- a/pytest_github_actions_annotate_failures/plugin.py +++ b/pytest_github_actions_annotate_failures/plugin.py @@ -127,14 +127,14 @@ def pytest_warning_recorded(self, warning_message, when, nodeid, location): # n def pytest_addoption(parser): group = parser.getgroup("pytest_github_actions_annotate_failures") group.addoption( - "--exclude-warnings", + "--exclude-warning-annotations", action="store_true", default=False, help="Annotate failures in GitHub Actions.", ) def pytest_configure(config): - if not config.option.exclude_warnings: + if not config.option.exclude_warning_annotations: config.pluginmanager.register(_AnnotateWarnings(), "annotate_warnings")