Skip to content
Snippets Groups Projects
Commit 986391a0 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

Task #10339: test fix(?)

parent 1fa34354
No related branches found
No related tags found
No related merge requests found
......@@ -9,11 +9,11 @@ import lofar.lta.ingest.server.ltacp
logger = logging.getLogger()
#helper var to pass filename between different stubbed Popen calls
global _local_globus_file_path
_local_globus_file_path = None
def stub():
logger.info('stubbing globus-url-copy Popen command')
global _local_globus_file_path
#replace original Popen with a stub
#this stub calls the normal Popen, except for when globus-url-copy is in the args
#then the globus-url-copy command is replaced by a fake 'transfer'
......@@ -29,7 +29,6 @@ def stub():
dpfilename = os.path.basename(dppath)
dest_path = [x for x in args[2].split() if 'srm://' in x][0]
dest_filename = os.path.basename(dest_path)
global _local_globus_file_path
_local_globus_file_path = '/tmp/globus_output_%s/%s' % (uuid.uuid1(), dest_filename)
os.makedirs(os.path.dirname(_local_globus_file_path))
args = ['cat', dppath.replace('file://', '')]
......@@ -74,6 +73,7 @@ def stub():
lofar.lta.ingest.server.ltacp.srmll = stub_srmll
def un_stub():
global _local_globus_file_path
#undo stubbing of Popen and srmll
logger.info('un-stubbing globus-url-copy Popen command')
subprocess.Popen.__init__ = subprocess.Popen.__init__org
......@@ -88,6 +88,5 @@ def un_stub():
if os.path.isdir(os.path.dirname(_local_globus_file_path)) and 'globus_output_' in os.path.dirname(_local_globus_file_path):
os.removedirs(os.path.dirname(_local_globus_file_path))
global _local_globus_file_path
_local_globus_file_path= None
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment