File: tests.py

package info (click to toggle)
python-catcher 0.1.7%2Bgit20140530-1
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 116 kB
  • ctags: 37
  • sloc: python: 257; makefile: 47
file content (23 lines) | stat: -rw-r--r-- 582 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from __future__ import print_function
import unittest
import catcher


class CollectorTest (unittest.TestCase):
    class Tester:
        def divide(self, a, b):
            return a / b

        def inner(self):
            self.divide(2, 0)

        def test(self):
            self.inner()

    def test_collection(self):
        try:
            CollectorTest.Tester().test()
        except Exception as e:
            report = catcher.collect(e)
        html = catcher.formatters.HTMLFormatter().format(report)
        print(catcher.uploaders.AjentiOrgUploader().upload(html))