simplistix / sybil

Automated testing for the examples in your documentation.

Home Page:https://sybil.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Numerours PytestDeprecationWarning raised when using Sybil

thirtytwobits opened this issue · comments

myvenv/python3.9/site-packages/sybil/integration/pytest.py:58: 193 warnings
  myvenv/lib/python3.9/site-packages/sybil/integration/pytest.py:58: PytestDeprecationWarning: A private pytest class or function was used.
    self._request = fixtures.FixtureRequest(self)

-- Docs: https://docs.pytest.org/en/stable/warnings.html

This has been going on for awhile. Doesn't break anything but it does normalize deviance having a huge number of warnings we are supposed to ignore.

Any ideas how we could fix this?

Do you have the full traceback for one of these?

As of pytest 6.2.0 the FixtureRequest class (and many other classes within _pytest) should be accessed this way.

However, the docs state

Constructing them is not supported (except for MonkeyPatch); they are only meant for use in type annotations. Doing so will emit a deprecation warning, and may become a hard-error in pytest 7.0.

Subclassing them is also not supported. This is not currently enforced at runtime, but is detected by type-checkers such as mypy.

@thirtytwobits You can silence this warning from being displayed by adding the following to your ini file

[pytest]
filterwarnings =
    ignore:A private pytest class or function was used:DeprecationWarning

Yeah, let's see what the latest hoop is that Sybil needs to jump through: pytest-dev/pytest#8832

Awesome! Tested this change against my code and it works great. Thanks.