FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python-can/test/test_interface_ixxat_fd.py at develop · feuerball/python-can · GitHub
feuerball
/
python-can
Public
forked from
hardbyte/python-can
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
python-can
/
test
/
test_interface_ixxat_fd.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
64 lines (48 loc) · 1.91 KB
Breadcrumbs
python-can
/
test
/
test_interface_ixxat_fd.py
Copy path
File metadata and controls
64 lines (48 loc) · 1.91 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python
"""
Unittest for ixxat interface using fd option.
Run only this test:
python setup.py test --addopts "--verbose -s test/test_interface_ixxat_fd.py"
"""
import
unittest
import
can
class
SoftwareTestCase
(
unittest
.
TestCase
):
"""
Test cases that test the software only and do not rely on an existing/connected hardware.
"""
def
setUp
(
self
):
try
:
bus
=
can
.
Bus
(
interface
=
"ixxat"
,
fd
=
True
,
channel
=
0
)
bus
.
shutdown
()
except
can
.
CanInterfaceNotImplementedError
:
raise
unittest
.
SkipTest
(
"not available on this platform"
)
def
test_bus_creation
(
self
):
# channel must be >= 0
with
self
.
assertRaises
(
ValueError
):
can
.
Bus
(
interface
=
"ixxat"
,
fd
=
True
,
channel
=
-
1
)
# rx_fifo_size must be > 0
with
self
.
assertRaises
(
ValueError
):
can
.
Bus
(
interface
=
"ixxat"
,
fd
=
True
,
channel
=
0
,
rx_fifo_size
=
0
)
# tx_fifo_size must be > 0
with
self
.
assertRaises
(
ValueError
):
can
.
Bus
(
interface
=
"ixxat"
,
fd
=
True
,
channel
=
0
,
tx_fifo_size
=
0
)
class
HardwareTestCase
(
unittest
.
TestCase
):
"""
Test cases that rely on an existing/connected hardware.
"""
def
setUp
(
self
):
try
:
bus
=
can
.
Bus
(
interface
=
"ixxat"
,
fd
=
True
,
channel
=
0
)
bus
.
shutdown
()
except
can
.
CanInterfaceNotImplementedError
:
raise
unittest
.
SkipTest
(
"not available on this platform"
)
def
test_bus_creation
(
self
):
# non-existent channel -> use arbitrary high value
with
self
.
assertRaises
(
can
.
CanInitializationError
):
can
.
Bus
(
interface
=
"ixxat"
,
fd
=
True
,
channel
=
0xFFFF
)
def
test_send_after_shutdown
(
self
):
with
can
.
Bus
(
interface
=
"ixxat"
,
fd
=
True
,
channel
=
0
)
as
bus
:
with
self
.
assertRaises
(
can
.
CanOperationError
):
bus
.
send
(
can
.
Message
(
arbitration_id
=
0x3FF
,
dlc
=
0
))
if
__name__
==
"__main__"
:
unittest
.
main
()
Back
|
FazBrowse Home
|
New Git URL