File: __init__.py

package info (click to toggle)
python-varlink 32.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 324 kB
  • sloc: python: 2,630; sh: 177; makefile: 31
file content (91 lines) | stat: -rw-r--r-- 2,551 bytes parent folder | download
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
"""An implementation of the varlink protocol

See https://www.varlink.org for more information about the varlink protocol and interface definition
files.

For server implementations use the :class:`varlink.Server` class.

For client implementations use the :class:`varlink.Client` class.

For installation and examples, see the GIT repository https://github.com/varlink/python.
or the `source code <_modules/varlink/tests/test_orgexamplemore.html>`_ of
:mod:`varlink.tests.test_orgexamplemore`

"""

import os

if hasattr(os, "fork"):
    __all__ = [
        "Client",
        "ClientInterfaceHandler",
        "SimpleClientInterfaceHandler",
        "Service",
        "RequestHandler",
        "Server",
        "ThreadingServer",
        "ForkingServer",
        "InterfaceNotFound",
        "MethodNotFound",
        "MethodNotImplemented",
        "InvalidParameter",
        "VarlinkEncoder",
        "VarlinkError",
        "Interface",
        "Scanner",
        "get_listen_fd",
    ]
    from .server import ForkingServer
else:
    __all__ = [
        "Client",
        "ClientInterfaceHandler",
        "SimpleClientInterfaceHandler",
        "Service",
        "RequestHandler",
        "Server",
        "ThreadingServer",
        "InterfaceNotFound",
        "MethodNotFound",
        "MethodNotImplemented",
        "InvalidParameter",
        "VarlinkEncoder",
        "VarlinkError",
        "Interface",
        "Scanner",
        "get_listen_fd",
    ]

from .client import Client, ClientInterfaceHandler, SimpleClientInterfaceHandler
from .error import (
    InterfaceNotFound,
    InvalidParameter,
    MethodNotFound,
    MethodNotImplemented,
    VarlinkEncoder,
    VarlinkError,
)
from .scanner import Interface, Scanner
from .server import RequestHandler, Server, Service, ThreadingServer, get_listen_fd


# There are no tests here, so don't try to run anything discovered from
# introspecting the symbols (e.g. FunctionTestCase). Instead, all our
# tests come from within varlink.tests.
def load_tests(loader, tests, pattern):
    import os.path
    import sys
    from fnmatch import fnmatch

    if pattern is None:
        pattern = "test_*.py"

    # top level directory cached on loader instance
    test_dir = os.path.dirname(__file__) + "/tests"
    for fn in os.listdir(test_dir):
        if fnmatch(fn, pattern):
            modname = "varlink.tests." + fn[:-3]
            __import__(modname)
            module = sys.modules[modname]
            tests.addTest(loader.loadTestsFromModule(module))
    return tests