Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RadioObservatory
LOFAR
Commits
986391a0
Commit
986391a0
authored
7 years ago
by
Jorrit Schaap
Browse files
Options
Downloads
Patches
Plain Diff
Task #10339: test fix(?)
parent
1fa34354
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
LTA/LTAIngest/LTAIngestServer/LTAIngestTransferServer/test/ltastubs.py
+2
-3
2 additions, 3 deletions
.../LTAIngestServer/LTAIngestTransferServer/test/ltastubs.py
with
2 additions
and
3 deletions
LTA/LTAIngest/LTAIngestServer/LTAIngestTransferServer/test/ltastubs.py
+
2
−
3
View file @
986391a0
...
...
@@ -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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment