Force serial testing when appropriate via tox
This commit is contained in:
parent
0dfa4b02f7
commit
5360f0e30c
|
@ -15,10 +15,18 @@ from twisted.python.failure import Failure
|
|||
from twisted.python.runtime import platform
|
||||
from twisted.internet.test.test_serialport import DoNothing
|
||||
|
||||
|
||||
testing_forced = os.environ.get('TWISTED_FORCE_SERIAL_TESTS', '')
|
||||
testing_forced = testing_forced.lower() in {'1', 'yes', 'true'}
|
||||
|
||||
|
||||
try:
|
||||
from twisted.internet import serialport
|
||||
import serial
|
||||
except ImportError:
|
||||
if testing_forced:
|
||||
raise
|
||||
|
||||
serialport = None
|
||||
serial = None
|
||||
|
||||
|
@ -68,11 +76,12 @@ class Win32SerialPortTests(unittest.TestCase):
|
|||
Minimal testing for Twisted's Win32 serial port support.
|
||||
"""
|
||||
|
||||
if not platform.isWindows():
|
||||
skip = "This test must run on Windows."
|
||||
if not testing_forced:
|
||||
if not platform.isWindows():
|
||||
skip = "This test must run on Windows."
|
||||
|
||||
elif not serialport:
|
||||
skip = "Windows serial port support is not available."
|
||||
elif not serialport:
|
||||
skip = "Windows serial port support is not available."
|
||||
|
||||
def setUp(self):
|
||||
# Re-usable protocol and reactor
|
||||
|
|
5
tox.ini
5
tox.ini
|
@ -39,6 +39,8 @@ extras =
|
|||
|
||||
alldeps-macos: osx_platform
|
||||
|
||||
serial: serial
|
||||
|
||||
; Documentation needs Twisted install to get the version.
|
||||
narrativedocs: dev
|
||||
|
||||
|
@ -88,6 +90,9 @@ setenv =
|
|||
; This includes variants of bit depth, unicode width, etc.
|
||||
wheels: CIBW_BUILD=cp27-* cp35-* cp36-* cp37-*
|
||||
|
||||
; If serial or windows extras, force serial testing
|
||||
{windows,serial}: TWISTED_FORCE_SERIAL_TESTS = 1
|
||||
|
||||
commands =
|
||||
;
|
||||
; Display information about Python interpreter
|
||||
|
|
Loading…
Reference in New Issue