This repository was archived by the owner on Jul 22, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,39 @@ def test_derived_class():
128
128
assert id (x ) == id (ob )
129
129
130
130
131
+ def test_derived_traceback ():
132
+ """Test python exception traceback in class derived from managed base"""
133
+ class DerivedClass (SubClassTest ):
134
+ __namespace__ = "Python.Test.traceback"
135
+
136
+ def foo (self ):
137
+ print (xyzname )
138
+ return None
139
+
140
+ import sys ,traceback
141
+ ob = DerivedClass ()
142
+
143
+ # direct call
144
+ try :
145
+ ob .foo ()
146
+ assert False
147
+ except :
148
+ e = sys .exc_info ()
149
+ assert "xyzname" in str (e [1 ])
150
+ location = traceback .extract_tb (e [2 ], - 1 )[0 ]
151
+ assert location [2 ] == "foo"
152
+
153
+ # call through managed code
154
+ try :
155
+ FunctionsTest .test_foo (ob )
156
+ assert False
157
+ except :
158
+ e = sys .exc_info ()
159
+ assert "xyzname" in str (e [1 ])
160
+ location = traceback .extract_tb (e [2 ], - 1 )[0 ]
161
+ assert location [2 ] == "foo"
162
+
163
+
131
164
def test_create_instance ():
132
165
"""Test derived instances can be created from managed code"""
133
166
DerivedClass = derived_class_fixture (test_create_instance .__name__ )
You can’t perform that action at this time.
0 commit comments