Skip to content

PyVirtualSerialPorts

nix virtual serial ports

Usage

usage: virtualserialports [-h] [-l] [-d] num_ports

positional arguments:
  num_ports       number of ports to create

optional arguments:
  -h, --help      show this help message and exit
  -l, --loopback  echo data back to the sending device too
  -d, --debug     log received data to stderr

Test example

from multiprocessing import Process
from unittest import TestCase, main

from virtualserialports import run as virtual_serial_ports_run


class TestAppTestCase(TestCase):
    def setUp(self):
        num_ports = 1
        loopback = True
        debug = False
        args = (num_ports, loopback, debug)
        self.process = Process(target=virtual_serial_ports_run, args=args)
        self.process.start()

    def tearDown(self):
        self.process.kill()
        self.process.join(timeout=8.0)

    def test_serials(self):
        # Test your code
        pass

See also

Favorite site