Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
opcua-asyncio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nikola Balog
opcua-asyncio
Commits
fc60e03c
Commit
fc60e03c
authored
Jul 30, 2018
by
Christian Bergmiller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactored common tests (wip)
parent
74338f97
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
935 additions
and
906 deletions
+935
-906
tests/conftest.py
tests/conftest.py
+42
-0
tests/test_client.py
tests/test_client.py
+1
-1
tests/test_common.py
tests/test_common.py
+891
-0
tests/test_server.py
tests/test_server.py
+1
-1
tests/tests_common.py
tests/tests_common.py
+0
-904
No files found.
tests/conftest.py
0 → 100644
View file @
fc60e03c
import
pytest
from
opcua
import
Client
from
opcua
import
Server
from
.test_common
import
add_server_methods
port_num1
=
48510
port_num
=
48540
def
pytest_generate_tests
(
metafunc
):
if
'opc'
in
metafunc
.
fixturenames
:
metafunc
.
parametrize
(
'opc'
,
[
'client'
,
'server'
],
indirect
=
True
)
@
pytest
.
fixture
()
async
def
opc
(
request
):
if
request
.
param
==
'client'
:
srv
=
Server
()
await
srv
.
init
()
srv
.
set_endpoint
(
f'opc.tcp://127.0.0.1:
{
port_num
}
'
)
await
add_server_methods
(
srv
)
await
srv
.
start
()
# start client
# long timeout since travis (automated testing) can be really slow
clt
=
Client
(
f'opc.tcp://127.0.0.1:
{
port_num
}
'
,
timeout
=
10
)
await
clt
.
connect
()
yield
clt
await
clt
.
disconnect
()
await
srv
.
stop
()
elif
request
.
param
==
'server'
:
# start our own server
# start our own server
srv
=
Server
()
await
srv
.
init
()
srv
.
set_endpoint
(
f'opc.tcp://127.0.0.1:
{
port_num
}
'
)
await
add_server_methods
(
srv
)
await
srv
.
start
()
yield
srv
# stop the server
await
srv
.
stop
()
else
:
raise
ValueError
(
"invalid internal test config"
)
tests/test_client.py
View file @
fc60e03c
...
...
@@ -6,7 +6,7 @@ from opcua import Client
from
opcua
import
Server
from
opcua
import
ua
from
.test
s
_common
import
add_server_methods
from
.test_common
import
add_server_methods
from
.tests_enum_struct
import
add_server_custom_enum_struct
port_num1
=
48510
...
...
tests/test_common.py
0 → 100644
View file @
fc60e03c
This diff is collapsed.
Click to expand it.
tests/test_server.py
View file @
fc60e03c
...
...
@@ -8,7 +8,7 @@ import logging
import
os
import
shelve
from
.test
s_common
import
CommonTests
,
add_server_methods
from
.test
_common
import
add_server_methods
from
.tests_xml
import
XmlTests
from
.tests_subscriptions
import
SubscriptionTests
from
datetime
import
timedelta
,
datetime
...
...
tests/tests_common.py
deleted
100644 → 0
View file @
74338f97
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment