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
adae3f2d
Commit
adae3f2d
authored
3 years ago
by
Jan David Mol
Browse files
Options
Downloads
Patches
Plain Diff
Hotpatch for logger - use DeviceContext to spawn a test device
parent
1be0203e
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
devices/test/common/test_lofar_logging.py
+9
-4
9 additions, 4 deletions
devices/test/common/test_lofar_logging.py
with
9 additions
and
4 deletions
devices/test/common/test_lofar_logging.py
+
9
−
4
View file @
adae3f2d
...
...
@@ -14,6 +14,7 @@ from common import lofar_logging
import
logging
from
tango.server
import
Device
from
tango
import
device_server
from
tango.test_context
import
DeviceTestContext
from
test
import
base
...
...
@@ -82,11 +83,15 @@ class TestLofarLogging(base.TestCase):
logger
.
info
(
"
test
"
)
with
mock
.
patch
.
object
(
device_server
.
DeviceImpl
,
'
__info_stream
'
)
as
m_info_stream
:
# logs in the constructor already
mydevice
=
MyDevice
(
None
,
"
MyDeviceNam
e
"
)
with
DeviceTestContext
(
MyDevice
)
as
mydevice
:
self
.
assertEqual
(
1
,
m_info_stream
.
call_count
,
msg
=
"
configure_logger did not send logs to active Tango devic
e
"
)
self
.
assertEqual
(
mydevice
,
self
.
memory_handler
.
records
[
0
].
tango_device
,
msg
=
"
configure_logging did not detect active Tango device
"
)
self
.
assertEqual
(
1
,
m_info_stream
.
call_count
,
msg
=
"
configure_logger did not send logs to active Tango device
"
)
# Lookup our "test" logline among f.e. the debug messages output by Tango
test_record
=
[
record
for
record
in
self
.
memory_handler
.
records
if
record
.
msg
==
"
test
"
]
# Tango uses slightly different class representations of MyDevice, so
# we can't compare them direclty. Just verify we're talking about the same thing.
self
.
assertEqual
(
str
(
mydevice
),
str
(
test_record
[
0
].
tango_device
),
msg
=
"
configure_logging did not detect active Tango device
"
)
def
test_log_exceptions
(
self
):
...
...
This diff is collapsed.
Click to expand it.
Corné Lukken
@lukken
mentioned in commit
5c1ad8b7
·
3 years ago
mentioned in commit
5c1ad8b7
mentioned in commit 5c1ad8b792103fb73d63fd72c65392ea89ab16f0
Toggle commit list
Corné Lukken
@lukken
mentioned in commit
94eb0e6d
·
3 years ago
mentioned in commit
94eb0e6d
mentioned in commit 94eb0e6df51fd29b8ae36b59692ffe8e38ae25b7
Toggle commit list
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