spec/pythonerror_spec.rb in rubypython-0.5.1 vs spec/pythonerror_spec.rb in rubypython-0.5.2
- old
+ new
@@ -33,6 +33,20 @@
cause_error
rbType, rbValue, rbTraceback = described_class.fetch
rbType.getAttr("__name__").rubify.should == "ImportError"
end
end
+
+ describe ".last_traceback" do
+ it "should make availble the Python traceback of the last error" do
+ traceback = RubyPython.import 'traceback'
+ errors = RubyPython.import 'errors'
+ begin
+ errors.nested_error
+ rescue RubyPython::PythonError => exc
+ tb = exc.traceback
+ list = traceback.format_tb(tb)
+ list.rubify[0].should =~ /1 \/ 0/
+ end
+ end
+ end
end