diff options
| -rw-r--r-- | debian/changelog | 1 | ||||
| -rw-r--r-- | tests/test_all.py | 15 |
2 files changed, 16 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index e076d029..c63d3a16 100644 --- a/debian/changelog +++ b/debian/changelog @@ -15,6 +15,7 @@ python-apt (0.7.93.2) UNRELEASED; urgency=low - Call lsb_release with -idrc instead of --all. * tests: - Fix aptsources tests to use local data files if available. + - test_all.py: Use local modules instead of system ones if possible. -- Julian Andres Klode <jak@debian.org> Sun, 07 Feb 2010 19:58:40 +0100 diff --git a/tests/test_all.py b/tests/test_all.py index ea74e09b..6900e0ad 100644 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -7,9 +7,24 @@ """Run all available unit tests.""" import os import unittest +import sys if __name__ == '__main__': os.chdir(os.path.dirname(__file__)) + # Find the path to the built apt_pkg and apt_inst extensions + if os.path.exists("../build"): + from distutils.util import get_platform + from distutils.sysconfig import get_python_version + # Set the path to the build directory. + plat_specifier = ".%s-%s" % (get_platform(), get_python_version()) + if sys.version_info[0] >= 3 or sys.version_info[1] >= 6: + library_dir = "../build/lib%s%s" % (plat_specifier, + (sys.pydebug and "-pydebug" or "")) + else: + library_dir = "../build/lib%s%s" % ((sys.pydebug and "_d" or ""), + plat_specifier) + sys.path.insert(0, os.path.abspath(library_dir)) + for path in os.listdir('.'): if path.endswith('.py') and os.path.isfile(path): exec('from %s import *' % path[:-3]) |
