summaryrefslogtreecommitdiff
path: root/src/_pytest/pytester.py
diff options
context:
space:
mode:
authorRan Benita <ran@unusedvar.com>2020-09-21 17:45:24 +0300
committerRan Benita <ran@unusedvar.com>2020-09-22 12:40:40 +0300
commita99ca879e7c9db0ac91324e701275e9439cf7b73 (patch)
tree99665f73dd072fea21855684787d3141366426d3 /src/_pytest/pytester.py
parentcdfdb3a25d1033f732072d9a4d2fb700feb73a09 (diff)
downloadpytest-a99ca879e7c9db0ac91324e701275e9439cf7b73.tar.gz
Mark some public and to-be-public classes as `@final`
This indicates at least for people using type checkers that these classes are not designed for inheritance and we make no stability guarantees regarding inheritance of them. Currently this doesn't show up in the docs. Sphinx does actually support `@final`, however it only works when imported directly from `typing`, while we import from `_pytest.compat`. In the future there might also be a `@sealed` decorator which would cover some more cases.
Diffstat (limited to 'src/_pytest/pytester.py')
-rw-r--r--src/_pytest/pytester.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/_pytest/pytester.py b/src/_pytest/pytester.py
index 5d8a45ad7..d78062a86 100644
--- a/src/_pytest/pytester.py
+++ b/src/_pytest/pytester.py
@@ -28,6 +28,7 @@ import pytest
from _pytest import timing
from _pytest._code import Source
from _pytest.capture import _get_multicapture
+from _pytest.compat import final
from _pytest.compat import overload
from _pytest.compat import TYPE_CHECKING
from _pytest.config import _PluggyPlugin
@@ -597,6 +598,7 @@ class SysPathsSnapshot:
sys.path[:], sys.meta_path[:] = self.__saved
+@final
class Testdir:
"""Temporary test directory with tools to test/run pytest itself.