Skip to content

Commit

Permalink
Merge 69d880c into 6f9098d
Browse files Browse the repository at this point in the history
  • Loading branch information
osherdp committed Aug 14, 2018
2 parents 6f9098d + 69d880c commit 8023b3e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -3,7 +3,7 @@

from setuptools import setup, find_packages

__version__ = "3.2.1"
__version__ = "3.2.2"

result_handlers = [
"db = rotest.core.result.handlers.db_handler:DBHandler",
Expand Down
14 changes: 1 addition & 13 deletions src/rotest/management/utils/resources_discoverer.py
Expand Up @@ -42,7 +42,7 @@ def _import_resources_from_module(module_path):
if _is_resource_class(item)}


def get_all_resources(app_name, blacklist=DISCOVERER_BLACKLIST):
def get_resources(app_name, blacklist=DISCOVERER_BLACKLIST):
"""Get all the resource classes under a Django app.
Args:
Expand Down Expand Up @@ -71,15 +71,3 @@ def get_all_resources(app_name, blacklist=DISCOVERER_BLACKLIST):
resources.update(module_resources)

return resources


def load_resources(app_name, blacklist=DISCOVERER_BLACKLIST):
"""Import all resources from an app and add them to the globals.
Args:
app_name (str): application to search for resources inside.
blacklist (tuple): module patterns to ignore.
"""
print "Loading resources from app", app_name
resources = get_all_resources(app_name, blacklist=blacklist)
globals().update(resources)
5 changes: 3 additions & 2 deletions src/rotest/management/utils/shell.py
Expand Up @@ -32,7 +32,7 @@
IMPORT_BLOCK_UTILS = \
"from rotest.management.utils.shell import shared_data, run_block"
IMPORT_RESOURCE_LOADER = \
"from rotest.management.utils.resources_discoverer import load_resources"
"from rotest.management.utils.resources_discoverer import get_resources"


class ShellMockFlow(object):
Expand Down Expand Up @@ -107,7 +107,8 @@ def main():

startup_commands = [IMPORT_BLOCK_UTILS, IMPORT_RESOURCE_LOADER]
for app_name in SHELL_APPS:
startup_commands.append("load_resources(%r)" % app_name)
startup_commands.append("globals().update(get_resources(%r))" %
app_name)

startup_commands.extend(SHELL_STARTUP_COMMANDS)
try:
Expand Down

0 comments on commit 8023b3e

Please sign in to comment.