diff options
-rw-r--r-- | functional_tests/support/string-exception/test.py | 30 | ||||
-rw-r--r-- | functional_tests/test_string_exception.py | 32 |
2 files changed, 62 insertions, 0 deletions
diff --git a/functional_tests/support/string-exception/test.py b/functional_tests/support/string-exception/test.py new file mode 100644 index 0000000..7b63d9d --- /dev/null +++ b/functional_tests/support/string-exception/test.py @@ -0,0 +1,30 @@ +import unittest +import warnings + +warnings.filterwarnings('ignore', category=DeprecationWarning, + module='test') + + +def test_string_exc(): + raise "string exception" + + +class TestStringExceptionInSetup(unittest.TestCase): + def setUp(self): + raise "string exception in setup" + + def testNothing(self): + pass + + +class TestStringExceptionInTeardown(unittest.TestCase): + def tearDown(self): + raise "string exception in teardown" + + def testNothing(self): + pass + + +class TestStringExceptionInClass(unittest.TestCase): + def testStringExc(self): + raise "string exception in test" diff --git a/functional_tests/test_string_exception.py b/functional_tests/test_string_exception.py new file mode 100644 index 0000000..396c92a --- /dev/null +++ b/functional_tests/test_string_exception.py @@ -0,0 +1,32 @@ +import os +import sys +import unittest + +from nose.plugins import PluginTester +from nose.plugins.builtin import Deprecated, Skip +from nose.plugins.skip import SkipTest + + +support = os.path.join(os.path.dirname(__file__), 'support') + + +class TestStringException(PluginTester, unittest.TestCase): + activate = '-v' + plugins = [Deprecated(), Skip()] + args = [] + suitepath = os.path.join(support, 'string-exception') + + def test_string_exception_works(self): + if sys.version_info >= (2, 6): + raise SkipTest("String exceptions are not supported in this " + "version of Python") + + print + print '!' * 70 + print str(self.output) + print '!' * 70 + print + assert 'raise "string exception"' in str(self.output) + assert 'raise "string exception in setup"' in str(self.output) + assert 'raise "string exception in teardown"' in str(self.output) + assert 'raise "string exception in test"' in str(self.output) |