Last active
February 12, 2018 04:06
-
-
Save kb1lqc/6c51b8be092f5aa43487d2e25a40491e to your computer and use it in GitHub Desktop.
Unit Testing Serial Ports | Serial Test Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Testing serial ports | |
# Import modules | |
import serial | |
class SerialTestClass(object): | |
"""A mock serial port test class""" | |
def __init__(self): | |
"""Creates a mock serial port which is a loopback object""" | |
self._port = "loop://" | |
self._timeout = 0 | |
self._baudrate = 115200 | |
self.serialPort = \ | |
serial.serial_for_url(url=self._port, | |
timeout=self._timeout, | |
baudrate=self._baudrate) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment