diff options
author | BubaVV <markov.vadim@gmail.com> | 2018-10-14 01:54:51 +0300 |
---|---|---|
committer | Marcel Hellkamp <marc@gsites.de> | 2020-12-31 17:01:02 +0100 |
commit | 2243ab241a4a3f05160d22dc42f054a824c426dd (patch) | |
tree | f23d7d069ffc3a15b278c151617aa13431bf2543 | |
parent | 5c48cee0ec3922fc8d83cd217d480d9486fcab2d (diff) | |
download | bottle-2243ab241a4a3f05160d22dc42f054a824c426dd.tar.gz |
Tests added to pass CI
Hope it's enough. Exception raising in wsgi() is covered
-rw-r--r-- | test/test_exc.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/test_exc.py b/test/test_exc.py new file mode 100644 index 0000000..fca38dc --- /dev/null +++ b/test/test_exc.py @@ -0,0 +1,30 @@ +import bottle +from .tools import ServerTestBase + +class TestError(Exception): + pass + +class TestAppException(ServerTestBase): + + def test_no_exc(self): + @bottle.route('/') + def test(): return 'test' + self.assertBody('test', '/') + + def test_memory_error(self): + @bottle.route('/') + def test(): raise MemoryError + self.assertRaises(MemoryError) + + def test_other_error(self): + @bottle.route('/') + def test(): raise TestError + self.assertRaises(TestError) + + def test_noncatched_error(self): + @bottle.route('/') + def test(): raise TestError + bottle.request.environ['exc_info'] = None + bottle.catchall = False + self.assertStatus(500, '/') + self.assertInBody('TestError') |