From ba86337c84546a9be80e6c11c53846ed8d745015 Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Wed, 16 Jan 2013 18:34:49 +0400 Subject: Add a test case for previous commit --- functional_tests/support/issue513/test.py | 3 +++ functional_tests/test_failure.py | 27 +++++++++++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 functional_tests/support/issue513/test.py create mode 100644 functional_tests/test_failure.py (limited to 'functional_tests') diff --git a/functional_tests/support/issue513/test.py b/functional_tests/support/issue513/test.py new file mode 100644 index 0000000..a0c6238 --- /dev/null +++ b/functional_tests/support/issue513/test.py @@ -0,0 +1,3 @@ +def test(): + raise '\xf1'.encode('ASCII') + yield diff --git a/functional_tests/test_failure.py b/functional_tests/test_failure.py new file mode 100644 index 0000000..ed856ae --- /dev/null +++ b/functional_tests/test_failure.py @@ -0,0 +1,27 @@ +import os +import unittest + +from nose.plugins import PluginTester + +support = os.path.join(os.path.dirname(__file__), 'support', 'issue513') + +class TestPrintedTraceback(PluginTester, unittest.TestCase): + args = ['--where='+support] + activate = "-v" + + def makeSuite(self): + # make PluginTester happy, because we don't specify suitepath, we + # have to implement this function + return None + + def test_correct_exception_raised(self): + print + print '!' * 70 + print str(self.output) + print '!' * 70 + print + assert 'ordinal not in range(128)' in str(self.output) + assert 'FAILED (errors=1)' in str(self.output) + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.1 From e9e63dcd2ea37ac8d3bd72c9d4a89e7a8a5e7b2e Mon Sep 17 00:00:00 2001 From: Dmitry Shachnev Date: Fri, 18 Jan 2013 14:44:27 +0400 Subject: test_failure.py: make the test a bit more strict (fix by @jszakmeister) --- functional_tests/test_failure.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'functional_tests') diff --git a/functional_tests/test_failure.py b/functional_tests/test_failure.py index ed856ae..e9d17e9 100644 --- a/functional_tests/test_failure.py +++ b/functional_tests/test_failure.py @@ -20,7 +20,9 @@ class TestPrintedTraceback(PluginTester, unittest.TestCase): print str(self.output) print '!' * 70 print - assert 'ordinal not in range(128)' in str(self.output) + + # Look for the line in the traceback causing the failure + assert "raise '\\xf1'.encode('ASCII')" in str(self.output) assert 'FAILED (errors=1)' in str(self.output) if __name__ == '__main__': -- cgit v1.2.1