mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-01 15:37:32 +08:00
Remove transaction helper from test.unit.workflows
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
from galaxy import model
|
||||
from galaxy.model.base import transaction
|
||||
from galaxy.model.unittest_utils.utils import random_email
|
||||
from galaxy.workflow.run_request import (
|
||||
_normalize_inputs,
|
||||
@@ -102,9 +101,8 @@ def __workflow_fixure(trans):
|
||||
setattr(workflow_step, key, value)
|
||||
workflow.steps.append(workflow_step)
|
||||
|
||||
trans.app.model.context.add(
|
||||
workflow,
|
||||
)
|
||||
session = trans.app.model.context
|
||||
session.add(workflow)
|
||||
|
||||
add_step(type="data_input", order_index=0, tool_inputs={"name": "input1"})
|
||||
add_step(type="data_input", order_index=1, tool_inputs={"name": "input2"})
|
||||
@@ -118,11 +116,9 @@ def __workflow_fixure(trans):
|
||||
tool_id="cat1",
|
||||
order_index=4,
|
||||
)
|
||||
session = trans.app.model.context
|
||||
with transaction(session):
|
||||
session.commit()
|
||||
session.commit()
|
||||
# Expunge and reload to ensure step state is as expected from database.
|
||||
workflow_id = workflow.id
|
||||
trans.app.model.context.expunge_all()
|
||||
session.expunge_all()
|
||||
|
||||
return trans.app.model.session.get(model.Workflow, workflow_id)
|
||||
return session.get(model.Workflow, workflow_id)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from typing import cast
|
||||
|
||||
from galaxy import model
|
||||
from galaxy.model.base import transaction
|
||||
from galaxy.util.unittest import TestCase
|
||||
from galaxy.workflow.run import (
|
||||
ModuleInjector,
|
||||
@@ -196,10 +195,9 @@ class TestWorkflowProgress(TestCase):
|
||||
subworkflow_invocation = self.invocation.create_subworkflow_invocation_for_step(
|
||||
self.invocation.workflow.step_by_index(1)
|
||||
)
|
||||
self.app.model.session.add(subworkflow_invocation)
|
||||
session = self.app.model.session
|
||||
with transaction(session):
|
||||
session.commit()
|
||||
session.add(subworkflow_invocation)
|
||||
session.commit()
|
||||
progress = self._new_workflow_progress()
|
||||
remaining_steps = progress.remaining_steps()
|
||||
(subworkflow_step, subworkflow_invocation_step) = remaining_steps[0]
|
||||
|
||||
@@ -5,7 +5,6 @@ import yaml
|
||||
from galaxy import model
|
||||
from galaxy.app_unittest_utils import galaxy_mock
|
||||
from galaxy.managers.workflows import WorkflowsManager
|
||||
from galaxy.model.base import transaction
|
||||
from galaxy.util.bunch import Bunch
|
||||
from galaxy.workflow.modules import module_factory
|
||||
|
||||
@@ -23,8 +22,7 @@ class MockTrans:
|
||||
workflow.stored_workflow = stored_workflow
|
||||
stored_workflow.user = self.user
|
||||
self.sa_session.add(stored_workflow)
|
||||
with transaction(self.sa_session):
|
||||
self.sa_session.commit()
|
||||
self.sa_session.commit()
|
||||
return stored_workflow
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user