Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
b978ca67
Commit
b978ca67
authored
Mar 05, 2013
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Добавил тесты для python
parent
4a046564
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
160 additions
and
0 deletions
+160
-0
start_fg.sh
python/tests/UConnector/start_fg.sh
+7
-0
test.xml
python/tests/UConnector/test.xml
+2
-0
testUC.py
python/tests/UConnector/testUC.py
+53
-0
uniset-start.sh
python/tests/UConnector/uniset-start.sh
+2
-0
start_fg.sh
python/tests/UInterface/start_fg.sh
+5
-0
test.xml
python/tests/UInterface/test.xml
+2
-0
testUI.py
python/tests/UInterface/testUI.py
+47
-0
uniset-start.sh
python/tests/UInterface/uniset-start.sh
+2
-0
testUModbus.py
python/tests/UModbus/testUModbus.py
+40
-0
No files found.
python/tests/UConnector/start_fg.sh
0 → 100755
View file @
b978ca67
#!/bin/sh
START
=
./uniset-start.sh
export
LD_LIBRARY_PATH
=
"../../lib/.libs;../../lib/pyUniSet/.libs"
${
START
}
-f
./testUC.py
--unideb-add-levels
info,warn,crit
python/tests/UConnector/test.xml
0 → 120000
View file @
b978ca67
../../../conf/test.xml
\ No newline at end of file
python/tests/UConnector/testUC.py
0 → 100755
View file @
b978ca67
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import
sys
sys
.
path
.
append
(
'./.libs/'
)
sys
.
path
.
append
(
'../../lib/pyUniSet/.libs/'
)
sys
.
path
.
append
(
'../../lib/pyUniSet/'
)
#from pyUniSet import *
from
pyUConnector
import
*
from
pyUExceptions
import
*
if
__name__
==
"__main__"
:
lst
=
Params_inst
()
for
i
in
range
(
0
,
len
(
sys
.
argv
)):
if
i
>=
Params
.
max
:
break
;
lst
.
add
(
sys
.
argv
[
i
]
)
p
=
[]
print
"lst: class: "
+
str
(
p
.
__class__
.
__name__
)
try
:
uc1
=
UConnector
(
lst
,
"test.xml"
)
# print "(0)UIType: %s" % uc1.getUIType()
print
"(1)getShortName: id=
%
d name=
%
s"
%
(
1
,
uc1
.
getShortName
(
1
))
# print " getName: id=%d name=%s" % (1, uc1.getName(101))
# print " getTextName: id=%d name=%s" % (1, uc1.getTextName(101))
# print "\n"
# print "getShortName: id=%d name=%s" % (2, uc1.getShortName(109))
# print " getName: id=%d name=%s" % (2, uc1.getName(109))
# print " getTextName: id=%d name=%s" % (2, uc1.getTextName(109))
try
:
print
"(1)setValue:
%
d=
%
d"
%
(
3
,
22
)
uc1
.
setValue
(
3
,
22
,
DefaultID
)
except
UException
,
e
:
print
"(1)setValue exception: "
+
str
(
e
.
getError
())
try
:
print
"(1)getValue:
%
d=
%
d"
%
(
3
,
uc1
.
getValue
(
3
,
DefaultID
)
)
except
UException
,
e
:
print
"(1)getValue exception: "
+
str
(
e
.
getError
())
except
UException
,
e
:
print
"(testUI): catch exception: "
+
str
(
e
.
getError
())
python/tests/UConnector/uniset-start.sh
0 → 120000
View file @
b978ca67
/home/pv/Projects/uniset/Utilities/scripts/uniset-start.sh
\ No newline at end of file
python/tests/UInterface/start_fg.sh
0 → 100755
View file @
b978ca67
#!/bin/sh
START
=
./uniset-start.sh
${
START
}
-f
./testUI.py
--unideb-add-levels
info,warn,crit
python/tests/UInterface/test.xml
0 → 120000
View file @
b978ca67
../../../conf/test.xml
\ No newline at end of file
python/tests/UInterface/testUI.py
0 → 100755
View file @
b978ca67
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import
sys
sys
.
path
.
append
(
'./.libs/'
)
sys
.
path
.
append
(
'../../lib/pyUniSet/.libs/'
)
sys
.
path
.
append
(
'../../lib/pyUniSet/'
)
from
pyUniSet
import
*
if
__name__
==
"__main__"
:
lst
=
Params_inst
()
for
i
in
range
(
0
,
len
(
sys
.
argv
)):
if
i
>=
Params
.
max
:
break
;
lst
.
add
(
sys
.
argv
[
i
]
)
try
:
uniset_init_params
(
lst
,
str
(
"test.xml"
)
)
print
"getShortName: id=
%
d name=
%
s"
%
(
1
,
getShortName
(
1
))
print
" getName: id=
%
d name=
%
s"
%
(
1
,
getName
(
1
))
print
" getTextName: id=
%
d name=
%
s"
%
(
1
,
getTextName
(
1
))
print
"
\n
"
print
"getShortName: id=
%
d name=
%
s"
%
(
2
,
getShortName
(
2
))
print
" getName: id=
%
d name=
%
s"
%
(
2
,
getName
(
2
))
print
" getTextName: id=
%
d name=
%
s"
%
(
2
,
getTextName
(
2
))
try
:
print
"getValue:
%
d=
%
d"
%
(
1
,
getValue
(
1
)
)
except
UException
,
e
:
print
"getValue exception: "
+
str
(
e
.
getError
())
try
:
print
"setValue:
%
d=
%
d"
%
(
14
,
setValue
(
14
,
22
))
except
UException
,
e
:
print
"setValue exception: "
+
str
(
e
.
getError
())
except
UException
,
e
:
print
"(testUI): catch exception: "
+
str
(
e
.
getError
())
\ No newline at end of file
python/tests/UInterface/uniset-start.sh
0 → 120000
View file @
b978ca67
/home/pv/Projects/uniset/Utilities/scripts/uniset-start.sh
\ No newline at end of file
python/tests/UModbus/testUModbus.py
0 → 100755
View file @
b978ca67
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import
sys
sys
.
path
.
append
(
'./.libs/'
)
sys
.
path
.
append
(
'../../lib/pyUniSet/.libs/'
)
sys
.
path
.
append
(
'../../lib/pyUniSet/'
)
from
pyUModbus
import
*
if
__name__
==
"__main__"
:
try
:
mb
=
UModbus
()
print
"UIType:
%
s"
%
mb
.
getUIType
()
mb
.
connect
(
"localhost"
,
2048
)
try
:
print
"Test READ functions..."
for
f
in
range
(
1
,
5
):
print
"func=
%
d reg=
%
d"
%
(
f
,
22
)
val
=
mb
.
mbread
(
0x01
,
22
,
f
,
"unsigned"
,
-
1
)
# val = mb.mbread(0x01,22)
print
"val=
%
d"
%
val
print
"getWord:
%
d"
%
mb
.
getWord
(
0x01
,
22
)
print
"getByte:
%
d"
%
mb
.
getByte
(
0x01
,
22
)
print
"getBit:
%
d"
%
mb
.
getBit
(
0x01
,
22
,
3
)
# print ""
# print "Test WRITE functions..."
# for f in range(1,6):
# print "func=%d reg=%d" % (f,22)
# val = mb.getValue(f,0x01,22,"unsigned",-1)
except
UException
,
e
:
print
"exception: "
+
str
(
e
.
getError
())
except
UException
,
e
:
print
"(testUModbus): catch exception: "
+
str
(
e
.
getError
())
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