File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -146,12 +146,16 @@ async def bar():
146
146
147
147
148
148
class ErrorsHelper :
149
+ @property
150
+ def raise_baseexception (self ):
151
+ raise BaseException ("base exception should be raised" )
152
+
149
153
@property
150
154
def raise_exception (self ):
151
155
raise Exception ("exception should be catched" )
152
156
153
157
@property
154
- def raise_fail (self ):
158
+ def raise_fail_outcome (self ):
155
159
pytest .fail ("fail should be catched" )
156
160
157
161
@@ -160,13 +164,15 @@ def test_helper_failures():
160
164
with pytest .raises (Exception ):
161
165
helper .raise_exception
162
166
with pytest .raises (OutcomeException ):
163
- helper .raise_fail
167
+ helper .raise_fail_outcome
164
168
165
169
166
170
def test_safe_getattr ():
167
171
helper = ErrorsHelper ()
168
172
assert safe_getattr (helper , "raise_exception" , "default" ) == "default"
169
- assert safe_getattr (helper , "raise_fail" , "default" ) == "default"
173
+ assert safe_getattr (helper , "raise_fail_outcome" , "default" ) == "default"
174
+ with pytest .raises (BaseException ):
175
+ assert safe_getattr (helper , "raise_baseexception" , "default" )
170
176
171
177
172
178
def test_safe_isclass ():
You can’t perform that action at this time.
0 commit comments