Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
tango
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
1ec527b3
Commit
1ec527b3
authored
3 years ago
by
Jan David Mol
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-577
: Mock sys.argv instead of setting it
parent
99e2a85b
No related branches found
No related tags found
1 merge request
!249
L2SS-577: Support multiple XST streams
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
tangostationcontrol/tangostationcontrol/test/test_statistics_writer.py
+9
-12
9 additions, 12 deletions
...ontrol/tangostationcontrol/test/test_statistics_writer.py
with
9 additions
and
12 deletions
tangostationcontrol/tangostationcontrol/test/test_statistics_writer.py
+
9
−
12
View file @
1ec527b3
...
@@ -12,22 +12,19 @@ from tangostationcontrol.statistics_writer import statistics_writer
...
@@ -12,22 +12,19 @@ from tangostationcontrol.statistics_writer import statistics_writer
import
sys
import
sys
from
os.path
import
dirname
from
os.path
import
dirname
from
tempfile
import
TemporaryDirectory
from
tempfile
import
TemporaryDirectory
from
unittest
import
mock
class
TestStatisticsWriter
(
base
.
TestCase
):
class
TestStatisticsWriter
(
base
.
TestCase
):
def
setUp
(
self
):
# strip all command-line arguments to allow us to redefine them in the test
sys
.
argv
=
[
sys
.
argv
[
0
]]
def
test_sst
(
self
):
def
test_sst
(
self
):
with
TemporaryDirectory
()
as
tmpdir
:
with
TemporaryDirectory
()
as
tmpdir
:
sys
.
argv
+
=
[
"
--mode
"
,
"
SST
"
,
"
--file
"
,
dirname
(
__file__
)
+
"
/SDP_SST_statistics_packets.bin
"
,
"
--output_dir
"
,
tmpdir
]
new_
sys
_
argv
=
[
sys
.
argv
[
0
],
"
--mode
"
,
"
SST
"
,
"
--file
"
,
dirname
(
__file__
)
+
"
/SDP_SST_statistics_packets.bin
"
,
"
--output_dir
"
,
tmpdir
]
with
mock
.
patch
.
object
(
statistics_writer
.
sys
,
'
argv
'
,
new_sys_argv
):
with
self
.
assertRaises
(
SystemExit
):
with
self
.
assertRaises
(
SystemExit
):
statistics_writer
.
main
()
statistics_writer
.
main
()
def
test_xst
(
self
):
def
test_xst
(
self
):
with
TemporaryDirectory
()
as
tmpdir
:
with
TemporaryDirectory
()
as
tmpdir
:
sys
.
argv
+
=
[
"
--mode
"
,
"
XST
"
,
"
--file
"
,
dirname
(
__file__
)
+
"
/SDP_XST_statistics_packets.bin
"
,
"
--output_dir
"
,
tmpdir
]
new_
sys
_
argv
=
[
sys
.
argv
[
0
],
"
--mode
"
,
"
XST
"
,
"
--file
"
,
dirname
(
__file__
)
+
"
/SDP_XST_statistics_packets.bin
"
,
"
--output_dir
"
,
tmpdir
]
with
mock
.
patch
.
object
(
statistics_writer
.
sys
,
'
argv
'
,
new_sys_argv
):
with
self
.
assertRaises
(
SystemExit
):
with
self
.
assertRaises
(
SystemExit
):
statistics_writer
.
main
()
statistics_writer
.
main
()
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