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
c43bfd67
Commit
c43bfd67
authored
3 years ago
by
Jan David Mol
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-412
: Use asynctest for tests (they didnt run without), and fix tests
parent
570b9d97
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
devices/test/base.py
+1
-1
1 addition, 1 deletion
devices/test/base.py
devices/test/clients/test_opcua_client.py
+3
-3
3 additions, 3 deletions
devices/test/clients/test_opcua_client.py
devices/test/common/test_lofar_logging.py
+2
-2
2 additions, 2 deletions
devices/test/common/test_lofar_logging.py
with
6 additions
and
6 deletions
devices/test/base.py
+
1
−
1
View file @
c43bfd67
...
@@ -31,7 +31,7 @@ class TestCase(BaseTestCase):
...
@@ -31,7 +31,7 @@ class TestCase(BaseTestCase):
super
().
setUp
()
super
().
setUp
()
class
AsyncTestCase
(
Base
TestCase
):
class
AsyncTestCase
(
testscenarios
.
WithScenarios
,
asynctest
.
TestCase
):
"""
Test case base class for all asyncio unit tests.
"""
"""
Test case base class for all asyncio unit tests.
"""
def
setUp
(
self
):
def
setUp
(
self
):
...
...
This diff is collapsed.
Click to expand it.
devices/test/clients/test_opcua_client.py
+
3
−
3
View file @
c43bfd67
...
@@ -70,7 +70,7 @@ class TestOPCua(base.AsyncTestCase):
...
@@ -70,7 +70,7 @@ class TestOPCua(base.AsyncTestCase):
@asynctest.patch.object
(
OPCUAConnection
,
"
ping
"
)
@asynctest.patch.object
(
OPCUAConnection
,
"
ping
"
)
@asynctest.patch.object
(
opcua_client
,
"
Client
"
)
@asynctest.patch.object
(
opcua_client
,
"
Client
"
)
@
mock
.patch.object
(
opcua_client
,
'
ProtocolAttribute
'
)
@
asynctest
.patch.object
(
opcua_client
,
'
ProtocolAttribute
'
)
async
def
test_opcua_attr_setup
(
self
,
m_protocol_attr
,
m_opc_client
,
m_ping
):
async
def
test_opcua_attr_setup
(
self
,
m_protocol_attr
,
m_opc_client
,
m_ping
):
"""
"""
This tests covers the correct creation of read/write functions.
This tests covers the correct creation of read/write functions.
...
@@ -238,9 +238,9 @@ class TestOPCua(base.AsyncTestCase):
...
@@ -238,9 +238,9 @@ class TestOPCua(base.AsyncTestCase):
# create the protocolattribute
# create the protocolattribute
if
len
(
j
)
==
1
:
if
len
(
j
)
==
1
:
test
=
opcua_client
.
ProtocolAttribute
(
m_node
,
j
[
0
],
0
,
opcua_client
.
numpy_to_OPCua_dict
[
i
.
numpy_type
]
,
self
.
loop
)
test
=
opcua_client
.
ProtocolAttribute
(
m_node
,
j
[
0
],
0
,
opcua_client
.
numpy_to_OPCua_dict
[
i
.
numpy_type
])
else
:
else
:
test
=
opcua_client
.
ProtocolAttribute
(
m_node
,
j
[
1
],
j
[
0
],
opcua_client
.
numpy_to_OPCua_dict
[
i
.
numpy_type
]
,
self
.
loop
)
test
=
opcua_client
.
ProtocolAttribute
(
m_node
,
j
[
1
],
j
[
0
],
opcua_client
.
numpy_to_OPCua_dict
[
i
.
numpy_type
])
# comparison function that replaces `set_data_value` inside the attributes write function
# comparison function that replaces `set_data_value` inside the attributes write function
async
def
compare_values
(
val
):
async
def
compare_values
(
val
):
...
...
This diff is collapsed.
Click to expand it.
devices/test/common/test_lofar_logging.py
+
2
−
2
View file @
c43bfd67
...
@@ -75,7 +75,7 @@ class TestLofarLogging(base.TestCase):
...
@@ -75,7 +75,7 @@ class TestLofarLogging(base.TestCase):
# create a Tango Device that logs something
# create a Tango Device that logs something
class
MyDevice
(
Device
):
class
MyDevice
(
Device
):
def
__
init_
_
(
self
):
def
init_
device
(
self
):
self
.
log_deeper_in_stack
()
self
.
log_deeper_in_stack
()
def
log_deeper_in_stack
(
self
):
def
log_deeper_in_stack
(
self
):
...
@@ -83,7 +83,7 @@ class TestLofarLogging(base.TestCase):
...
@@ -83,7 +83,7 @@ class TestLofarLogging(base.TestCase):
with
mock
.
patch
.
object
(
device_server
.
DeviceImpl
,
'
__info_stream
'
)
as
m_info_stream
:
with
mock
.
patch
.
object
(
device_server
.
DeviceImpl
,
'
__info_stream
'
)
as
m_info_stream
:
# logs in the constructor already
# logs in the constructor already
mydevice
=
MyDevice
()
mydevice
=
MyDevice
(
None
,
"
MyDeviceName
"
)
self
.
assertEqual
(
mydevice
,
self
.
memory_handler
.
records
[
0
].
tango_device
,
msg
=
"
configure_logging did not detect active Tango device
"
)
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
"
)
self
.
assertEqual
(
1
,
m_info_stream
.
call_count
,
msg
=
"
configure_logger did not send logs to active Tango device
"
)
...
...
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