Skip to content
GitLab
Explore
Sign in
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LOFAR2.0
tango
Commits
aa6e445b
Commit
aa6e445b
authored
2 years ago
by
Corné Lukken
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-938
: Implement device server code coverage commands
parent
661f1094
Branches
Branches containing commit
No related tags found
1 merge request
!475
Draft: L2SS-938: Device server code coverage testing
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tangostationcontrol/tangostationcontrol/devices/lofar_device.py
+10
-6
10 additions, 6 deletions
...tationcontrol/tangostationcontrol/devices/lofar_device.py
with
10 additions
and
6 deletions
tangostationcontrol/tangostationcontrol/devices/lofar_device.py
+
10
−
6
View file @
aa6e445b
...
@@ -199,6 +199,7 @@ class lofar_device(Device, metaclass=DeviceMeta):
...
@@ -199,6 +199,7 @@ class lofar_device(Device, metaclass=DeviceMeta):
elif
not
mask
[
idx
]:
elif
not
mask
[
idx
]:
merge_values
[
idx
]
=
current_values
[
idx
]
merge_values
[
idx
]
=
current_values
[
idx
]
@command
()
def
store_coverage
(
self
):
def
store_coverage
(
self
):
try
:
try
:
self
.
cov
.
stop
()
self
.
cov
.
stop
()
...
@@ -206,6 +207,8 @@ class lofar_device(Device, metaclass=DeviceMeta):
...
@@ -206,6 +207,8 @@ class lofar_device(Device, metaclass=DeviceMeta):
logger
.
info
(
"
Stopped code coverage measurements
"
)
logger
.
info
(
"
Stopped code coverage measurements
"
)
except
Exception
:
except
Exception
:
pass
pass
@command
()
def
start_coverage
(
self
):
def
start_coverage
(
self
):
try
:
try
:
import
os
import
os
...
@@ -213,24 +216,25 @@ class lofar_device(Device, metaclass=DeviceMeta):
...
@@ -213,24 +216,25 @@ class lofar_device(Device, metaclass=DeviceMeta):
import
coverage
import
coverage
self
.
cov
=
coverage
.
Coverage
(
self
.
cov
=
coverage
.
Coverage
(
config_file
=
os
.
getcwd
()
+
"
/tangostationcontrol/.coveragerc
"
,
data_file
=
os
.
getcwd
()
+
"
/tangostationcontrol/.coverage
"
,
data_file
=
os
.
getcwd
()
+
"
/tangostationcontrol/.coverage
"
,
data_suffix
=
True
,
data_suffix
=
True
branch
=
True
,
#
branch=True,
source
=
os
.
getcwd
()
+
"
/tangostationcontrol/tangostationcontrol
"
#
source=os.getcwd() + "/tangostationcontrol/tangostationcontrol"
)
)
self
.
cov
.
start
()
self
.
cov
.
start
()
logger
.
info
(
"
Started code coverage measurements: %s
"
,
os
.
getcwd
())
logger
.
info
(
"
Started code coverage measurements: %s
"
,
os
.
getcwd
())
atexit
.
register
(
self
.
store_coverage
)
atexit
.
register
(
self
.
store_coverage
)
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
warning
(
"
Could not configure for code coverage: %s
"
,
e
)
logger
.
exception
(
"
Could not configure for code coverage: %s
"
,
e
)
@log_exceptions
()
@log_exceptions
()
def
init_device
(
self
):
def
init_device
(
self
):
"""
Instantiates the device in the OFF state.
"""
"""
Instantiates the device in the OFF state.
"""
if
constants
.
DEBUG
:
#
if constants.DEBUG:
self
.
start_coverage
()
#
self.start_coverage()
# NOTE: Will delete_device first, if necessary
# NOTE: Will delete_device first, if necessary
Device
.
init_device
(
self
)
Device
.
init_device
(
self
)
...
...
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