/usr/lib/python3/dist-packages/pyutilib/component/loader/tests/test_load.py is in python3-pyutilib 5.3.5-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #
# Unit Tests for component/core
#
import os
from os.path import abspath, dirname
currdir = dirname(abspath(__file__))+os.sep
import pyutilib.th as unittest
import pyutilib.component.core
#
# This class is declared to facilitate coverage
#
class DummyPlugin(pyutilib.component.core.Plugin):
pyutilib.component.core.implements(pyutilib.component.core.IPluginLoadPath)
pyutilib.component.core.implements(pyutilib.component.core.IPluginLoader)
def get_load_path(self):
return []
def load(self, x, y, z, w):
pass
class TestLoader(unittest.TestCase):
def setUp(self):
pyutilib.component.core.PluginGlobals.add_env("testing.loader")
DummyPlugin()
def tearDown(self):
pyutilib.component.core.PluginGlobals.remove_env("testing.loader")
def test_load1(self):
pyutilib.component.core.PluginGlobals.get_env().load_services(path=currdir+"plugins1", auto_disable=True, name_re="^$")
def test_load2(self):
pyutilib.component.core.PluginGlobals.get_env().load_services(path=[currdir+"plugins1", currdir+"plugins2"], auto_disable="^$", name_re="^$")
def test_load3(self):
try:
pyutilib.component.core.PluginGlobals.get_env().load_services(path={})
self.fail("expect error")
except pyutilib.component.core.PluginError:
pass
def test_load4(self):
pyutilib.component.core.PluginGlobals.load_services(auto_disable="", name_re="^$")
def test_load5(self):
pyutilib.component.core.PluginGlobals.get_env().load_services(path=[currdir+"plugins1", currdir+"plugins2"], auto_disable=False, name_re="^$")
def test_load6(self):
pyutilib.component.core.PluginGlobals.get_env().load_services(path=[currdir+"plugins1", currdir+"plugins2"], auto_disable=False, name_re=True)
if __name__ == "__main__":
unittest.main()
|