summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorChris Liechti <cliechti@gmx.net>2015-08-03 17:20:12 +0200
committerChris Liechti <cliechti@gmx.net>2015-08-03 17:20:12 +0200
commit418a2229c80f05d1964562ec9c050007b969a833 (patch)
treeae4c9f973546d81530b8d9a3ccf4731b06edcf56 /test
parent798aa7392c4221930edc014c59e1e543c0a07ca2 (diff)
downloadpyserial-git-418a2229c80f05d1964562ec9c050007b969a833.tar.gz
make that tests are also found when ivoking from other directory
Diffstat (limited to 'test')
-rw-r--r--test/run_all_tests.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/test/run_all_tests.py b/test/run_all_tests.py
index e7f115d..0fbd3b8 100644
--- a/test/run_all_tests.py
+++ b/test/run_all_tests.py
@@ -12,10 +12,7 @@ import os
import time
# inject local copy to avoid testing the installed version instead of the
-# working copy (only for 2.x as the sources would need to be translated with
-# 2to3 for Python 3, use installed module instead for Python 3).
-if sys.version_info < (3, 0):
- sys.path.insert(0, '..')
+sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
import serial
print("Patching sys.path to test local version. Testing Version: %s" % (serial.VERSION,))
@@ -26,8 +23,9 @@ if len(sys.argv) > 1:
# find files and the tests in them
mainsuite = unittest.TestSuite()
-for modulename in [os.path.splitext(x)[0]
- for x in os.listdir('.')
+for modulename in [
+ os.path.splitext(x)[0]
+ for x in os.listdir(os.path.dirname(__file__))
if x != __file__ and x.startswith("test") and x.endswith(".py")
]:
try: