@@ -96,37 +96,37 @@ class TestClass:
96
96
"""
97
97
98
98
@upytest .skip ("This test will be skipped" )
99
- def test_skipped (self ):
99
+ def test_in_class_skipped (self ):
100
100
assert False # This will not be executed.
101
101
102
102
@upytest .skip (
103
103
"This test will be skipped with a skip_when condition" , skip_when = True
104
104
)
105
- def test_when_skipped (self ):
105
+ def test_in_class_when_skipped (self ):
106
106
assert False # This will not be executed.
107
107
108
108
@upytest .skip (
109
109
"This test will NOT be skipped with a False-y skip_when" ,
110
110
skip_when = False ,
111
111
)
112
- def test_when_not_skipped_passes (self ):
112
+ def test_in_class_when_not_skipped_passes (self ):
113
113
assert True , "This test passes"
114
114
115
- def test_passes (self ):
115
+ def test_in_class_passes (self ):
116
116
assert True , "This test passes"
117
117
118
- def test_fails (self ):
118
+ def test_in_class_fails (self ):
119
119
assert False , "This test will fail"
120
120
121
- def test_raises_exception_passes (self ):
121
+ def test_in_class_raises_exception_passes (self ):
122
122
with upytest .raises (ValueError ):
123
123
raise ValueError ("This is a ValueError" )
124
124
125
- def test_does_not_raise_exception_fails (self ):
125
+ def test_in_class_does_not_raise_exception_fails (self ):
126
126
with upytest .raises (ValueError ):
127
127
pass
128
128
129
- def test_does_not_raise_expected_exception_fails (self ):
129
+ def test_in_class_does_not_raise_expected_exception_fails (self ):
130
130
with upytest .raises (ValueError , AssertionError ):
131
131
raise TypeError ("This is a TypeError" )
132
132
@@ -175,3 +175,44 @@ async def test_async_does_not_raise_exception_fails():
175
175
async def test_async_does_not_raise_expected_exception_fails ():
176
176
with upytest .raises (ValueError , AssertionError ):
177
177
raise TypeError ("This is a TypeError" )
178
+
179
+
180
+ class TestAsyncClass :
181
+ """
182
+ An asynchronous class based version of the above tests.
183
+ """
184
+
185
+ @upytest .skip ("This test will be skipped" )
186
+ async def test_async_in_class_skipped (self ):
187
+ assert False # This will not be executed.
188
+
189
+ @upytest .skip (
190
+ "This test will be skipped with a skip_when condition" , skip_when = True
191
+ )
192
+ async def test_async_in_class_when_skipped (self ):
193
+ assert False # This will not be executed.
194
+
195
+ @upytest .skip (
196
+ "This test will NOT be skipped with a False-y skip_when" ,
197
+ skip_when = False ,
198
+ )
199
+ async def test_async_in_class_when_not_skipped_passes (self ):
200
+ assert True , "This test passes"
201
+
202
+ async def test_async_in_class_passes (self ):
203
+ assert True , "This test passes"
204
+
205
+ async def test_async_in_class_fails (self ):
206
+ assert False , "This test will fail"
207
+
208
+ async def test_async_in_class_raises_exception_passes (self ):
209
+ with upytest .raises (ValueError ):
210
+ raise ValueError ("This is a ValueError" )
211
+
212
+ async def test_async_in_class_does_not_raise_exception_fails (self ):
213
+ with upytest .raises (ValueError ):
214
+ pass
215
+
216
+ async def test_async_in_class_does_not_raise_expected_exception_fails (self ):
217
+ with upytest .raises (ValueError , AssertionError ):
218
+ raise TypeError ("This is a TypeError" )
0 commit comments