diff options
author | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2009-08-07 18:49:40 +0000 |
---|---|---|
committer | cliechti <cliechti@f19166aa-fa4f-0410-85c2-fa1106f25c8a> | 2009-08-07 18:49:40 +0000 |
commit | b97e4370ab8f10a10f627e803d300b77c3230fef (patch) | |
tree | 48eddadbcaa676d886458c1ebf409932ecdc8a48 /examples | |
parent | af42df2fdebe4317c0a700d94a480c446b9ae3b0 (diff) | |
download | pyserial-b97e4370ab8f10a10f627e803d300b77c3230fef.tar.gz |
- ensure working copy is tested, not library from system
- suppress error when port by number does not work (so that loop:// succeeds the tests)
git-svn-id: http://svn.code.sf.net/p/pyserial/code/trunk/pyserial@322 f19166aa-fa4f-0410-85c2-fa1106f25c8a
Diffstat (limited to 'examples')
-rw-r--r-- | examples/run_all_tests.py | 4 | ||||
-rw-r--r-- | examples/test_advanced.py | 12 |
2 files changed, 12 insertions, 4 deletions
diff --git a/examples/run_all_tests.py b/examples/run_all_tests.py index 636a0b6..b4a954d 100644 --- a/examples/run_all_tests.py +++ b/examples/run_all_tests.py @@ -11,6 +11,10 @@ import sys import os import time +# inject local copy to avoid testing the installed version instead of the +# working copy +sys.path.insert(0, '..') + PORT = 'loop://' # find files and the tests in them diff --git a/examples/test_advanced.py b/examples/test_advanced.py index a1a475b..6c45006 100644 --- a/examples/test_advanced.py +++ b/examples/test_advanced.py @@ -50,10 +50,14 @@ class Test_ChangeAttributes(unittest.TestCase): # test on the fly change self.s.open() self.failUnless(self.s.isOpen()) - self.s.port = 0 - self.failUnless(self.s.isOpen()) - self.failUnlessEqual(self.s.port, 0) - self.failUnlessEqual(self.s.portstr, serial.device(0)) + try: + self.s.port = 0 + except serial.SerialException: # port not available on system + pass # can't test on this machine... + else: + self.failUnless(self.s.isOpen()) + self.failUnlessEqual(self.s.port, 0) + self.failUnlessEqual(self.s.portstr, serial.device(0)) try: self.s.port = 1 except serial.SerialException: # port not available on system |