File tree 2 files changed +19
-17
lines changed 2 files changed +19
-17
lines changed Original file line number Diff line number Diff line change 10
10
"""
11
11
from __future__ import absolute_import , division , print_function
12
12
13
- import attr
14
13
15
- from _pytest .warning_types import RemovedInPytest4Warning
16
-
17
-
18
- @attr .s
19
- class UnformattedWarning (object ):
20
- """Used to hold warnings that need to format their message at runtime, as opposed to a direct message.
21
-
22
- Using this class avoids to keep all the warning types and messages in this module, avoiding misuse.
23
- """
24
-
25
- category = attr .ib ()
26
- template = attr .ib ()
27
-
28
- def format (self , ** kwargs ):
29
- """Returns an instance of the warning category, formatted with given kwargs"""
30
- return self .category (self .template .format (** kwargs ))
14
+ from _pytest .warning_types import UnformattedWarning , RemovedInPytest4Warning
31
15
32
16
33
17
MAIN_STR_ARGS = RemovedInPytest4Warning (
Original file line number Diff line number Diff line change
1
+ import attr
2
+
3
+
1
4
class PytestWarning (UserWarning ):
2
5
"""
3
6
Bases: :class:`UserWarning`.
@@ -39,4 +42,19 @@ def simple(cls, apiname):
39
42
)
40
43
41
44
45
+ @attr .s
46
+ class UnformattedWarning (object ):
47
+ """Used to hold warnings that need to format their message at runtime, as opposed to a direct message.
48
+
49
+ Using this class avoids to keep all the warning types and messages in this module, avoiding misuse.
50
+ """
51
+
52
+ category = attr .ib ()
53
+ template = attr .ib ()
54
+
55
+ def format (self , ** kwargs ):
56
+ """Returns an instance of the warning category, formatted with given kwargs"""
57
+ return self .category (self .template .format (** kwargs ))
58
+
59
+
42
60
PYTESTER_COPY_EXAMPLE = PytestExperimentalApiWarning .simple ("testdir.copy_example" )
You can’t perform that action at this time.
0 commit comments