|
@@ 94-111 (lines=18) @@
|
| 91 |
|
plugins.handlers.PyFilePlugin(test_file.strpath) |
| 92 |
|
|
| 93 |
|
|
| 94 |
|
def test_plugin_load_pypackage(tmpdir): |
| 95 |
|
root = tmpdir.mkdir('loader_mods') |
| 96 |
|
package_dir = root.mkdir('dir_mod') |
| 97 |
|
mod_file = package_dir.join('__init__.py') |
| 98 |
|
mod_file.write(MOCK_MODULE_CONTENT) |
| 99 |
|
|
| 100 |
|
plugin = plugins.handlers.PyFilePlugin(package_dir.strpath) |
| 101 |
|
plugin.load() |
| 102 |
|
|
| 103 |
|
test_mod = plugin._module |
| 104 |
|
|
| 105 |
|
assert hasattr(test_mod, 'first_command') |
| 106 |
|
assert hasattr(test_mod, 'second_command') |
| 107 |
|
assert hasattr(test_mod, 'interval5s') |
| 108 |
|
assert hasattr(test_mod, 'interval10s') |
| 109 |
|
assert hasattr(test_mod, 'example_url') |
| 110 |
|
assert hasattr(test_mod, 'shutdown') |
| 111 |
|
assert hasattr(test_mod, 'ignored') |
| 112 |
|
|
| 113 |
|
|
| 114 |
|
def test_plugin_load_pypackage_bad_dir_empty(tmpdir): |
|
@@ 57-73 (lines=17) @@
|
| 54 |
|
""" |
| 55 |
|
|
| 56 |
|
|
| 57 |
|
def test_plugin_load_pymod(tmpdir): |
| 58 |
|
root = tmpdir.mkdir('loader_mods') |
| 59 |
|
mod_file = root.join('file_mod.py') |
| 60 |
|
mod_file.write(MOCK_MODULE_CONTENT) |
| 61 |
|
|
| 62 |
|
plugin = plugins.handlers.PyFilePlugin(mod_file.strpath) |
| 63 |
|
plugin.load() |
| 64 |
|
|
| 65 |
|
test_mod = plugin._module |
| 66 |
|
|
| 67 |
|
assert hasattr(test_mod, 'first_command') |
| 68 |
|
assert hasattr(test_mod, 'second_command') |
| 69 |
|
assert hasattr(test_mod, 'interval5s') |
| 70 |
|
assert hasattr(test_mod, 'interval10s') |
| 71 |
|
assert hasattr(test_mod, 'example_url') |
| 72 |
|
assert hasattr(test_mod, 'shutdown') |
| 73 |
|
assert hasattr(test_mod, 'ignored') |
| 74 |
|
|
| 75 |
|
|
| 76 |
|
def test_plugin_load_pymod_bad_file_pyc(tmpdir): |