Skip to content

Commit

Permalink
Splits enable_package() out of tests.utils:execute
Browse files Browse the repository at this point in the history
  • Loading branch information
remram44 committed Apr 2, 2015
1 parent 4006baf commit a76fc52
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions vistrails/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,21 @@
from vistrails.core.modules.vistrails_module import Module


def enable_package(identifier):
"""Enables a package.
"""
from vistrails.core.packagemanager import get_package_manager

pm = get_package_manager()

dep_graph = pm.build_dependency_graph([identifier])
for pkg_id in pm.get_ordered_dependencies(dep_graph):
pkg = pm.identifier_is_available(pkg_id)
if pkg is None:
raise
pm.late_enable_package(pkg.codepath)


def execute(modules, connections=[], add_port_specs=[],
enable_pkg=True, full_results=False):
"""Build a pipeline and execute it.
Expand Down Expand Up @@ -143,12 +158,7 @@ def execute(modules, connections=[], add_port_specs=[],
except MissingPackage:
if not enable_pkg:
raise
dep_graph = pm.build_dependency_graph([identifier])
for pkg_id in pm.get_ordered_dependencies(dep_graph):
pkg = pm.identifier_is_available(pkg_id)
if pkg is None:
raise
pm.late_enable_package(pkg.codepath)
enable_package(identifier)
pkg = pm.get_package(identifier)

for func_name, params in functions:
Expand Down

0 comments on commit a76fc52

Please sign in to comment.