-
Notifications
You must be signed in to change notification settings - Fork 11
/
tests.py
executable file
·59 lines (58 loc) · 2.17 KB
/
tests.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
51
52
53
54
55
56
57
58
59
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Internal Tests
#
from httpwookiee.core.result import TextStatusResult
from httpwookiee.core.testrunner import WookieeTestRunner
from httpwookiee.config import ConfigFactory
import httpwookiee.client.tests_regular
# import httpwookiee.client.tests_first_line
# import httpwookiee.client.tests_content_length
# import httpwookiee.client.tests_chunks
# (...)
import tests.messages
import tests.internal_server
import inspect
import unittest
import os
import sys
if __name__ == '__main__':
# use env HTTPWOOKIEE_CONF to override defaults and force AUTOTEST
# where client testers will run against our proxy backend, without using
# any proxy, in fact.
currdir = os.path.dirname(os.path.realpath(__file__))
os.environ["HTTPWOOKIEE_CONF"] = os.path.join(currdir,
"tests",
"tests.ini")
config = ConfigFactory.getConfig()
if config.getboolean('DEBUG'):
verbosity = 2
else:
verbosity = 1
testcases = []
# Pre Flight tests, detect features support
for name, obj in inspect.getmembers(httpwookiee.client.tests_regular):
if 'Test' == name[:4] and inspect.isclass(obj):
testcases.append(obj)
classes = []
classes.append(tests.messages)
classes.append(tests.internal_server)
classes.append(httpwookiee.client.tests_regular)
# classes.append(httpwookiee.client.tests_first_line)
# classes.append(httpwookiee.client.tests_content_length)
# classes.append(httpwookiee.client.tests_chunks)
# (...)
for tclass in classes:
for name, obj in inspect.getmembers(tclass):
if 'Test' == name[:4] and inspect.isclass(obj):
testcases.append(obj)
tl = unittest.TestLoader()
suites = [tl.loadTestsFromTestCase(classobj)
for classobj in testcases]
testSuite = unittest.TestSuite(suites)
# without stream forced here python 2.7 is failing
WookieeTestRunner(resultclass=TextStatusResult,
verbosity=verbosity,
buffer=True,
stream=sys.stderr).run(testSuite)