Move PytestExerimentalApiWarning to warning_types
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
class PytestExerimentalApiWarning(FutureWarning):
|
||||
"warning category used to denote experiments in pytest"
|
||||
|
||||
@classmethod
|
||||
def simple(cls, apiname):
|
||||
return cls(
|
||||
"{apiname} is an experimental api that may change over time".format(
|
||||
apiname=apiname
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
PYTESTER_COPY_EXAMPLE = PytestExerimentalApiWarning.simple("testdir.copy_example")
|
||||
@@ -642,10 +642,12 @@ class Testdir(object):
|
||||
return p
|
||||
|
||||
def copy_example(self, name=None):
|
||||
from . import experiments
|
||||
import warnings
|
||||
|
||||
warnings.warn(experiments.PYTESTER_COPY_EXAMPLE, stacklevel=2)
|
||||
warnings.warn(
|
||||
pytest.PytestExerimentalApiWarning.simple("testdir.copy_example"),
|
||||
stacklevel=2,
|
||||
)
|
||||
example_dir = self.request.config.getini("pytester_example_dir")
|
||||
if example_dir is None:
|
||||
raise ValueError("pytester_example_dir is unset, can't copy examples")
|
||||
|
||||
@@ -20,3 +20,20 @@ class RemovedInPytest4Warning(PytestDeprecationWarning):
|
||||
|
||||
Warning class for features scheduled to be removed in pytest 4.0.
|
||||
"""
|
||||
|
||||
|
||||
class PytestExerimentalApiWarning(PytestWarning, FutureWarning):
|
||||
"""
|
||||
Bases: :class:`pytest.PytestWarning`, :class:`FutureWarning`.
|
||||
|
||||
Warning category used to denote experiments in pytest. Use sparingly as the API might change or even be
|
||||
removed completely in future version
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def simple(cls, apiname):
|
||||
return cls(
|
||||
"{apiname} is an experimental api that may change over time".format(
|
||||
apiname=apiname
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user