| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,13 @@ | |||
| 1 | + #!/usr/bin/env python | ||
| 2 | + # coding: utf-8 | ||
| 3 | + | ||
| 4 | + """ | ||
| 5 | + This module tests two virtual busses attached to each other. | ||
| 6 | + | ||
| 7 | + Some tests are skipped when run on Travis CI because they are not | ||
| 8 | + reproducible, see #243 (https://github.com/hardbyte/python-can/issues/243). | ||
| 9 | + """ | ||
| 10 | + | ||
| 1 | 11 | import os | |
| 2 | 12 | import unittest | |
| 3 | 13 | import time | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,2 @@ | |||
| 1 | + #!/usr/bin/env python | ||
| 2 | + # coding: utf-8 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,4 +1,5 @@ | |||
| 1 | - # -*- coding: utf-8 -*- | ||
| 1 | + #!/usr/bin/env python | ||
| 2 | + # coding: utf-8 | ||
| 2 | 3 | ||
| 3 | 4 | """ | |
| 4 | 5 | This module contains some example data, like messages of different | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,9 @@ | |||
| 1 | + #!/usr/bin/env python | ||
| 2 | + # coding: utf-8 | ||
| 3 | + | ||
| 4 | + """ | ||
| 5 | + """ | ||
| 6 | + | ||
| 1 | 7 | from time import sleep | |
| 2 | 8 | import unittest | |
| 3 | 9 | import random | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,6 @@ | |||
| 1 | + #!/usr/bin/env python | ||
| 2 | + # coding: utf-8 | ||
| 3 | + | ||
| 1 | 4 | """ | |
| 2 | 5 | This test module test the separate reader/writer combinations of the can.io.* | |
| 3 | 6 | modules by writing some messages to a temporary file and reading it again. | |
@@ -8,6 +11,8 @@ | |||
| 8 | 11 | comments. | |
| 9 | 12 | """ | |
| 10 | 13 | ||
| 14 | + from __future__ import print_function | ||
| 15 | + | ||
| 11 | 16 | import unittest | |
| 12 | 17 | import tempfile | |
| 13 | 18 | from time import sleep | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,6 @@ | |||
| 1 | + #!/usr/bin/env python | ||
| 2 | + # coding: utf-8 | ||
| 3 | + | ||
| 1 | 4 | from __future__ import print_function | |
| 2 | 5 | ||
| 3 | 6 | import unittest | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,31 +1,17 @@ | |||
| 1 | - # -*- coding: utf-8 -*- | ||
| 1 | + #!/usr/bin/env python | ||
| 2 | + # coding: utf-8 | ||
| 2 | 3 | ||
| 3 | 4 | """ | |
| 4 | - Name: serial_test | ||
| 5 | - Purpose: Testing the serial interface | ||
| 5 | + This module is testing the serial interface. | ||
| 6 | 6 | ||
| 7 | - Copyright: 2017 Boris Wenzlaff | ||
| 8 | - | ||
| 9 | - This file is part of python-can <https://github.com/hardbyte/python-can/>. | ||
| 10 | - | ||
| 11 | - python-can is free software: you can redistribute it and/or modify | ||
| 12 | - it under the terms of the GNU Lesser General Public License as published by | ||
| 13 | - the Free Software Foundation, either version 3 of the License, or | ||
| 14 | - any later version. | ||
| 15 | - | ||
| 16 | - python-can is distributed in the hope that it will be useful, | ||
| 17 | - but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 18 | - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 19 | - GNU Lesser General Public License for more details. | ||
| 20 | - | ||
| 21 | - You should have received a copy of the GNU Lesser General Public License | ||
| 22 | - along with python-can. If not, see <http://www.gnu.org/licenses/>. | ||
| 7 | + Copyright: 2017 Boris Wenzlaff | ||
| 23 | 8 | """ | |
| 24 | 9 | ||
| 25 | 10 | import unittest | |
| 11 | + from mock import patch | ||
| 12 | + | ||
| 26 | 13 | import can | |
| 27 | 14 | from can.interfaces.serial.serial_can import SerialBus | |
| 28 | - from mock import patch | ||
| 29 | 15 | ||
| 30 | 16 | ||
| 31 | 17 | class SerialDummy: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,3 +1,13 @@ | |||
| 1 | + #!/usr/bin/env python | ||
| 2 | + # coding: utf-8 | ||
| 3 | + | ||
| 4 | + """ | ||
| 5 | + This module tests cyclic send tasks. | ||
| 6 | + | ||
| 7 | + Some tests are skipped when run on Travis CI because they are not | ||
| 8 | + reproducible, see #243 (https://github.com/hardbyte/python-can/issues/243). | ||
| 9 | + """ | ||
| 10 | + | ||
| 1 | 11 | import os | |
| 2 | 12 | from time import sleep | |
| 3 | 13 | import unittest | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,9 +1,14 @@ | |||
| 1 | - #!/usr/bin/env python3 | ||
| 1 | + #!/usr/bin/env python | ||
| 2 | + # coding: utf-8 | ||
| 3 | + | ||
| 4 | + """ | ||
| 5 | + """ | ||
| 6 | + | ||
| 2 | 7 | import ctypes | |
| 3 | 8 | import unittest | |
| 4 | 9 | import time | |
| 5 | 10 | import logging | |
| 6 | - logging.basicConfig(level=logging.DEBUG) | ||
| 11 | + | ||
| 7 | 12 | import can | |
| 8 | 13 | from can.interfaces.kvaser import canlib | |
| 9 | 14 | from can.interfaces.kvaser import constants | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,13 @@ | |||
| 1 | + #!/usr/bin/env python | ||
| 2 | + # coding: utf-8 | ||
| 3 | + | ||
| 4 | + """ | ||
| 5 | + """ | ||
| 6 | + | ||
| 1 | 7 | from time import sleep | |
| 2 | 8 | import unittest | |
| 3 | 9 | import logging | |
| 10 | + | ||
| 4 | 11 | import can | |
| 5 | 12 | ||
| 6 | 13 | logging.getLogger(__file__).setLevel(logging.DEBUG) | |
@@ -11,7 +18,8 @@ class ZeroDLCTest(unittest.TestCase): | |||
| 11 | 18 | def test_recv_non_zero_dlc(self): | |
| 12 | 19 | bus_send = can.interface.Bus(bustype='virtual') | |
| 13 | 20 | bus_recv = can.interface.Bus(bustype='virtual') | |
| 14 | - msg_send = can.Message(extended_id=False, arbitration_id=0x100, data=[0,1,2,3,4,5,6,7]) | ||
| 21 | + data = [0, 1, 2, 3, 4, 5, 6, 7] | ||
| 22 | + msg_send = can.Message(extended_id=False, arbitration_id=0x100, data=data) | ||
| 15 | 23 | ||
| 16 | 24 | bus_send.send(msg_send) | |
| 17 | 25 | msg_recv = bus_recv.recv() | |
@@ -27,7 +35,6 @@ def test_recv_none(self): | |||
| 27 | 35 | # Receiving nothing should evaluate msg_recv to False | |
| 28 | 36 | self.assertFalse(msg_recv) | |
| 29 | 37 | ||
| 30 | - | ||
| 31 | 38 | def test_recv_zero_dlc(self): | |
| 32 | 39 | bus_send = can.interface.Bus(bustype='virtual') | |
| 33 | 40 | bus_recv = can.interface.Bus(bustype='virtual') | |
@@ -39,5 +46,6 @@ def test_recv_zero_dlc(self): | |||
| 39 | 46 | # Receiving a frame without data (dlc == 0) should evaluate msg_recv to True | |
| 40 | 47 | self.assertTrue(msg_recv) | |
| 41 | 48 | ||
| 49 | + | ||
| 42 | 50 | if __name__ == '__main__': | |
| 43 | 51 | unittest.main() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments