-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathtests.py
More file actions
60 lines (51 loc) · 1.51 KB
/
tests.py
File metadata and controls
60 lines (51 loc) · 1.51 KB
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
51
52
53
54
55
56
57
58
59
60
import doctest
import sys
import unittest
from .layer import (
HttpsTestServerLayer,
ensure_cratedb_layer,
setUpCrateLayerBaseline,
setUpWithHttps,
tearDownDropEntitiesBaseline,
)
def test_suite():
suite = unittest.TestSuite()
flags = doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS
# Unit tests.
suite.addTest(doctest.DocTestSuite("crate.client.connection"))
suite.addTest(doctest.DocTestSuite("crate.client.http"))
if sys.version_info >= (3, 10):
# This suite includes converter tests,
# which are only available with Python 3.10 and newer.
s = doctest.DocFileSuite(
"docs/by-example/connection.rst",
"docs/by-example/cursor.rst",
module_relative=False,
optionflags=flags,
encoding="utf-8",
)
suite.addTest(s)
s = doctest.DocFileSuite(
"docs/by-example/https.rst",
module_relative=False,
setUp=setUpWithHttps,
optionflags=flags,
encoding="utf-8",
)
s.layer = HttpsTestServerLayer()
suite.addTest(s)
# Integration tests.
layer = ensure_cratedb_layer()
s = doctest.DocFileSuite(
"docs/by-example/http.rst",
"docs/by-example/client.rst",
"docs/by-example/blob.rst",
module_relative=False,
setUp=setUpCrateLayerBaseline,
tearDown=tearDownDropEntitiesBaseline,
optionflags=flags,
encoding="utf-8",
)
s.layer = layer
suite.addTest(s)
return suite