11"""Module describing the planemo ``test`` command."""
22import click
3-
3+ from contextlib import ExitStack
44from planemo import options
55from planemo .cli import command_function
66from planemo .engine .test import (
@@ -66,10 +66,13 @@ def cli(ctx, uris, **kwds):
6666 against that same Galaxy root - but this may not be bullet proof yet so
6767 please careful and do not try this against production Galaxy instances.
6868 """
69- with temp_directory (dir = ctx .planemo_directory ) as temp_path :
69+ with ExitStack () as stack :
70+ if not kwds ["serve" ]:
71+ temp_path = stack .enter_context (temp_directory (dir = ctx .planemo_directory ))
72+ else :
73+ temp_path = None
7074 # Create temp dir(s) outside of temp, docker can't mount $TEMPDIR on OSX
7175 runnables = for_runnable_identifiers (ctx , uris , kwds , temp_path = temp_path )
72-
7376 # pick a default engine type if needed
7477 is_cwl = all (r .type in {RunnableType .cwl_tool , RunnableType .cwl_workflow } for r in runnables )
7578 if kwds .get ("engine" , None ) is None :
@@ -79,7 +82,6 @@ def cli(ctx, uris, **kwds):
7982 kwds ["engine" ] = "external_galaxy"
8083 else :
8184 kwds ["engine" ] = "galaxy"
82-
8385 return_value = test_runnables (ctx , runnables , original_paths = uris , ** kwds )
8486
8587 ctx .exit (return_value )
0 commit comments