-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrun_doctests.py
50 lines (43 loc) · 1.42 KB
/
run_doctests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import sys
import doctest
# The modules to be tested
from fhirbug.Fhir.Resources import fhirabstractbase
from fhirbug.Fhir.Resources import extensions
from fhirbug.Fhir import resources
from fhirbug.server import requestparser
from fhirbug.db.backends import SQLAlchemy
from fhirbug.models import attributes, pagination
def testResourceContructor(verbose=False):
# Create the extra globals
context = {"Patient": resources.Patient, "Identifier": resources.Identifier}
# Run the tests!
doctest.testmod(
fhirabstractbase,
extraglobs=context,
optionflags=doctest.NORMALIZE_WHITESPACE,
verbose=verbose,
)
doctest.testmod(
extensions,
extraglobs=context,
optionflags=doctest.NORMALIZE_WHITESPACE,
verbose=verbose,
)
doctest.testmod(
resources, optionflags=doctest.NORMALIZE_WHITESPACE, verbose=verbose
)
doctest.testmod(
requestparser, optionflags=doctest.NORMALIZE_WHITESPACE, verbose=verbose
)
doctest.testmod(
SQLAlchemy, optionflags=doctest.NORMALIZE_WHITESPACE, verbose=verbose
)
doctest.testmod(
attributes, optionflags=doctest.NORMALIZE_WHITESPACE, verbose=verbose
)
doctest.testmod(
pagination, optionflags=doctest.NORMALIZE_WHITESPACE, verbose=verbose
)
if __name__ == "__main__":
verbose = True if "-v" in sys.argv else False
testResourceContructor(verbose)