@@ -96,37 +96,37 @@ class TestClass:
9696 """
9797
9898 @upytest .skip ("This test will be skipped" )
99- def test_skipped (self ):
99+ def test_in_class_skipped (self ):
100100 assert False # This will not be executed.
101101
102102 @upytest .skip (
103103 "This test will be skipped with a skip_when condition" , skip_when = True
104104 )
105- def test_when_skipped (self ):
105+ def test_in_class_when_skipped (self ):
106106 assert False # This will not be executed.
107107
108108 @upytest .skip (
109109 "This test will NOT be skipped with a False-y skip_when" ,
110110 skip_when = False ,
111111 )
112- def test_when_not_skipped_passes (self ):
112+ def test_in_class_when_not_skipped_passes (self ):
113113 assert True , "This test passes"
114114
115- def test_passes (self ):
115+ def test_in_class_passes (self ):
116116 assert True , "This test passes"
117117
118- def test_fails (self ):
118+ def test_in_class_fails (self ):
119119 assert False , "This test will fail"
120120
121- def test_raises_exception_passes (self ):
121+ def test_in_class_raises_exception_passes (self ):
122122 with upytest .raises (ValueError ):
123123 raise ValueError ("This is a ValueError" )
124124
125- def test_does_not_raise_exception_fails (self ):
125+ def test_in_class_does_not_raise_exception_fails (self ):
126126 with upytest .raises (ValueError ):
127127 pass
128128
129- def test_does_not_raise_expected_exception_fails (self ):
129+ def test_in_class_does_not_raise_expected_exception_fails (self ):
130130 with upytest .raises (ValueError , AssertionError ):
131131 raise TypeError ("This is a TypeError" )
132132
@@ -175,3 +175,44 @@ async def test_async_does_not_raise_exception_fails():
175175async def test_async_does_not_raise_expected_exception_fails ():
176176 with upytest .raises (ValueError , AssertionError ):
177177 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