summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Karl Ramm <kcr@1ts.org>2009-08-01 19:55:14 +0000
committerGravatar Karl Ramm <kcr@1ts.org>2009-08-01 19:55:14 +0000
commite4ca408b86f1c4846f46cb5de7af89dcc67fcc78 (patch)
tree404d3e28923a3c305acad677a7a6ae913e0eb54a
parent58477d8b58231a3ffb594aeb19bb616378b0701f (diff)
Further refactor the library locater, and make the doctests use it
-rwxr-xr-xlib/zephyr_tests.py18
-rw-r--r--lib/zephyr_tests.txt2
2 files changed, 9 insertions, 11 deletions
diff --git a/lib/zephyr_tests.py b/lib/zephyr_tests.py
index 371ab99..4685c87 100755
--- a/lib/zephyr_tests.py
+++ b/lib/zephyr_tests.py
@@ -62,20 +62,18 @@ def py_make_zcode(input):
"""reference ZMakeZcode expressed as python..."""
return "Z" + input.replace("\xff", "\xff\xf1").replace("\0", "\xff\xf0")
+def find_libzephyr(builddir='.'):
+ # find the library
+ libzephyr_paths = ['libzephyr.so', 'libzephyr.dylib']
+ libzephyr_paths += [os.path.join('.libs', i) for i in libzephyr_paths]
+ libzephyr_paths = [os.path.join(builddir, i) for i in libzephyr_paths]
+ libzephyr_paths = [i for i in libzephyr_paths if os.path.exists(i)]
+ return libzephyr_paths[0]
class ZephyrTestSuite(TestSuite):
"""Tests for libzephyr"""
def setup(self):
- # find the library
- libzephyr_paths = ['libzephyr.so', 'libzephyr.dylib']
- libzephyr_paths += [os.path.join('.libs', i) for i in libzephyr_paths]
- libzephyr_paths = [os.path.join(self.builddir, i) for i in libzephyr_paths]
- libzephyr_paths = [i for i in libzephyr_paths if os.path.exists(i)]
- libzephyr_path = libzephyr_paths[0]
- # check for libtool...
- if not os.path.exists(libzephyr_path):
- libzephyr_path = os.path.join(self.builddir, ".libs", "libzephyr.so.4.0.0")
- self._libzephyr = libZephyr(libzephyr_path)
+ self._libzephyr = libZephyr(find_libzephyr(self.builddir))
def cleanup(self):
# no cleanup needed yet
diff --git a/lib/zephyr_tests.txt b/lib/zephyr_tests.txt
index 6b3e0c6..31a5da5 100644
--- a/lib/zephyr_tests.txt
+++ b/lib/zephyr_tests.txt
@@ -17,7 +17,7 @@ Generic library setup that should be moved into zephyr_tests.py:
>>> import os
>>> import zephyr_tests
>>> buildpath = zephyr_tests.find_buildpath()
- >>> libzephyr_path = os.path.join(buildpath, ".libs", "libzephyr.so.4.0.0")
+ >>> libzephyr_path = zephyr_tests.find_libzephyr()
>>> _z = zephyr_tests.libZephyr(libzephyr_path)
ZInit() got run by libZephyr, internally. Make sure other things