Skip to content

Commit

Permalink
isolate soma-workflow in a temp directory during tests
Browse files Browse the repository at this point in the history
  • Loading branch information
denisri committed Jun 7, 2024
1 parent 2e179f3 commit de62c81
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions capsul/pipeline/test/test_pipeline_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
from capsul.api import Pipeline, PipelineNode
from capsul.pipeline import pipeline_workflow
from capsul.study_config.study_config import StudyConfig
from soma_workflow.configuration import \
change_soma_workflow_directory, restore_soma_workflow_directory
import tempfile
import shutil
import socket


class DummyProcess(Process):
Expand Down Expand Up @@ -186,9 +189,14 @@ def setUp(self):
study_config.somaworkflow_keep_succeeded_workflows = False
self.exec_ids = []

# use a custom temporary soma-workflow dir to avoid concurrent
# access problems
change_soma_workflow_directory(self.tmpdir, socket.gethostname())

def tearDown(self):
for exec_id in self.exec_ids:
self.study_config.engine.dispose(exec_id)
restore_soma_workflow_directory()
try:
shutil.rmtree(self.tmpdir)
except Exception:
Expand Down

0 comments on commit de62c81

Please sign in to comment.