Skip to content

Commit c0b3835

Browse files
committed
flask unit tests
1 parent 0408503 commit c0b3835

File tree

2 files changed

+516
-0
lines changed

2 files changed

+516
-0
lines changed

tests/__init__.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import os
2+
import sys
3+
import unittest
4+
5+
import coverage
6+
7+
8+
def run():
9+
os.environ['FLASK_ENV'] = 'testing'
10+
11+
# start coverage engine
12+
cov = coverage.Coverage(branch=True)
13+
cov.start()
14+
15+
# run tests
16+
tests = unittest.TestLoader().discover('.')
17+
ok = unittest.TextTestRunner(verbosity=2).run(tests).wasSuccessful()
18+
19+
# print coverage report
20+
cov.stop()
21+
print('')
22+
cov.report(omit=['tests/*', 'venv*/*'])
23+
24+
sys.exit(0 if ok else 1)

0 commit comments

Comments
 (0)