diff options
author | Chris Liechti <cliechti@gmx.net> | 2016-05-26 17:14:58 +0200 |
---|---|---|
committer | Chris Liechti <cliechti@gmx.net> | 2016-05-26 17:14:58 +0200 |
commit | 77d922b37478443135c495e37c9c784711d54a87 (patch) | |
tree | 8b020bfd11dabc260453861a6e86b83073d07557 /test/test_cancel.py | |
parent | 3401840263f36691495ddb749def54e6fbd9ddf4 (diff) | |
download | pyserial-git-77d922b37478443135c495e37c9c784711d54a87.tar.gz |
style: flake8 findings
Diffstat (limited to 'test/test_cancel.py')
-rw-r--r-- | test/test_cancel.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/test/test_cancel.py b/test/test_cancel.py index e1a0634..210891b 100644 --- a/test/test_cancel.py +++ b/test/test_cancel.py @@ -7,8 +7,6 @@ """ Test cancel functionality. """ - -import os import sys import unittest import threading @@ -18,6 +16,7 @@ import serial # on which port should the tests be performed: PORT = 'loop://' + @unittest.skipIf(not hasattr(serial.Serial, 'cancel_read'), "cancel_read not supported on platform") class TestCancelRead(unittest.TestCase): """Test cancel_read functionality""" @@ -46,7 +45,7 @@ class TestCancelRead(unittest.TestCase): self.s.read(1000) t2 = time.time() self.assertEqual(self.cancel_called, 1) - self.assertTrue(0.5 < (t2 - t1) < 2, 'Function did not return in time: {}'.format(t2-t1)) + self.assertTrue(0.5 < (t2 - t1) < 2, 'Function did not return in time: {}'.format(t2 - t1)) #~ self.assertTrue(not self.s.isOpen()) #~ self.assertRaises(serial.SerialException, self.s.open) @@ -55,7 +54,8 @@ class TestCancelRead(unittest.TestCase): #~ self.s.read() -DATA = b'#'*1024 +DATA = b'#' * 1024 + @unittest.skipIf(not hasattr(serial.Serial, 'cancel_write'), "cancel_read not supported on platform") class TestCancelWrite(unittest.TestCase): @@ -89,7 +89,7 @@ class TestCancelWrite(unittest.TestCase): self.s.write(DATA) t2 = time.time() self.assertEqual(self.cancel_called, 1) - self.assertTrue(0.5 < (t2 - t1) < 2, 'Function did not return in time: {}'.format(t2-t1)) + self.assertTrue(0.5 < (t2 - t1) < 2, 'Function did not return in time: {}'.format(t2 - t1)) #~ self.assertTrue(not self.s.isOpen()) #~ self.assertRaises(serial.SerialException, self.s.open) @@ -100,7 +100,6 @@ class TestCancelWrite(unittest.TestCase): if __name__ == '__main__': - import sys sys.stdout.write(__doc__) if len(sys.argv) > 1: PORT = sys.argv[1] |