Decorator to make a simple function into a normal test via unittest.
(func)
| 55 | |
| 56 | # Simple example of the basic idea |
| 57 | def as_unittest(func): |
| 58 | """Decorator to make a simple function into a normal test via unittest.""" |
| 59 | class Tester(unittest.TestCase): |
| 60 | def test(self): |
| 61 | func() |
| 62 | |
| 63 | Tester.__name__ = func.__name__ |
| 64 | |
| 65 | return Tester |
| 66 | |
| 67 | # Utility functions |
| 68 |
nothing calls this directly
no outgoing calls
no test coverage detected