Skip to content

Commit

Permalink
move lsof warning to something ignorable and ignore it
Browse files Browse the repository at this point in the history
  • Loading branch information
graingert committed Dec 13, 2024
1 parent cc5b555 commit a3881db
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ filterwarnings = [
"ignore:VendorImporter\\.find_spec\\(\\) not found; falling back to find_module\\(\\):ImportWarning",
# https://github.com/pytest-dev/execnet/pull/127
"ignore:isSet\\(\\) is deprecated, use is_set\\(\\) instead:DeprecationWarning",
# https://github.com/pytest-dev/pytest/issues/2366
# https://github.com/pytest-dev/pytest/pull/13057
"default:.*:pytest.PytestFDWarning",
]
pytester_example_dir = "testing/example_scripts"
markers = [
Expand Down
4 changes: 2 additions & 2 deletions src/_pytest/pytester.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
from _pytest.reports import CollectReport
from _pytest.reports import TestReport
from _pytest.tmpdir import TempPathFactory
from _pytest.warning_types import PytestWarning
from _pytest.warning_types import PytestFDWarning


if TYPE_CHECKING:
Expand Down Expand Up @@ -188,7 +188,7 @@ def pytest_runtest_protocol(self, item: Item) -> Generator[None, object, object]
"*** function {}:{}: {} ".format(*item.location),
"See issue #2366",
]
item.warn(PytestWarning("\n".join(error)))
item.warn(PytestFDWarning("\n".join(error)))

Check warning on line 191 in src/_pytest/pytester.py

View check run for this annotation

Codecov / codecov/patch

src/_pytest/pytester.py#L191

Added line #L191 was not covered by tests


# used at least by pytest-xdist plugin
Expand Down
5 changes: 5 additions & 0 deletions src/_pytest/warning_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ def format(self, **kwargs: Any) -> _W:
return self.category(self.template.format(**kwargs))


@final
class PytestFDWarning(PytestWarning):
pass


def warn_explicit_for(method: FunctionType, message: PytestWarning) -> None:
"""
Issue the warning :param:`message` for the definition of the given :param:`method`
Expand Down
2 changes: 2 additions & 0 deletions src/pytest/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
from _pytest.warning_types import PytestConfigWarning
from _pytest.warning_types import PytestDeprecationWarning
from _pytest.warning_types import PytestExperimentalApiWarning
from _pytest.warning_types import PytestFDWarning
from _pytest.warning_types import PytestRemovedIn9Warning
from _pytest.warning_types import PytestUnhandledThreadExceptionWarning
from _pytest.warning_types import PytestUnknownMarkWarning
Expand Down Expand Up @@ -124,6 +125,7 @@
"PytestConfigWarning",
"PytestDeprecationWarning",
"PytestExperimentalApiWarning",
"PytestFDWarning",
"PytestPluginManager",
"PytestRemovedIn9Warning",
"PytestUnhandledThreadExceptionWarning",
Expand Down

0 comments on commit a3881db

Please sign in to comment.