Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# A module can always find its own source as well (the hello module
# calls get_plugin_source() itself).
with source:
from dummy.plugins import hello
assert hello.get_plugin_source() is source
# Last but not least the plugin source can be found by module names
# (in a plugin source block by the import name and in any case by
# the internal name)
with source:
assert get_plugin_source('dummy.plugins.hello') is source
assert get_plugin_source(hello.__name__) is source
# As well as by module object.
assert get_plugin_source(hello) is source
# Inside a source block we can find the source through mere calling.
with source:
assert get_plugin_source() is source
# A module can always find its own source as well (the hello module
# calls get_plugin_source() itself).
with source:
from dummy.plugins import hello
assert hello.get_plugin_source() is source
# Last but not least the plugin source can be found by module names
# (in a plugin source block by the import name and in any case by
# the internal name)
with source:
assert get_plugin_source('dummy.plugins.hello') is source
assert get_plugin_source(hello.__name__) is source
# As well as by module object.
assert get_plugin_source(hello) is source
# Inside a source block we can find the source through mere calling.
with source:
assert get_plugin_source() is source
# A module can always find its own source as well (the hello module
# calls get_plugin_source() itself).
with source:
from dummy.plugins import hello
assert hello.get_plugin_source() is source
# Last but not least the plugin source can be found by module names
# (in a plugin source block by the import name and in any case by
# the internal name)
with source:
assert get_plugin_source('dummy.plugins.hello') is source
assert get_plugin_source(hello.__name__) is source
# As well as by module object.
assert get_plugin_source(hello) is source
def test_fetching_plugin_source(source):
# Finding the plugin source outside of a plugin and without a with
# block of a plugin source returns None.
assert get_plugin_source() is None
# Inside a source block we can find the source through mere calling.
with source:
assert get_plugin_source() is source
# A module can always find its own source as well (the hello module
# calls get_plugin_source() itself).
with source:
from dummy.plugins import hello
assert hello.get_plugin_source() is source
# Last but not least the plugin source can be found by module names
# (in a plugin source block by the import name and in any case by
# the internal name)
with source:
assert get_plugin_source('dummy.plugins.hello') is source
assert get_plugin_source(hello.__name__) is source
# As well as by module object.
assert get_plugin_source(hello) is source