diff options
| author | Julian Andres Klode <jak@debian.org> | 2010-02-13 17:05:58 +0100 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2010-02-13 17:05:58 +0100 |
| commit | eb37b3a44fe8e6f15de5211d89fcf63cdf2f6fa6 (patch) | |
| tree | e2b35e94064ed2e1eaf4d26cca2327dc241a1747 /tests | |
| parent | 5d3142e5fb0d6d9389b5942ccca1d720262fb690 (diff) | |
| download | python-apt-eb37b3a44fe8e6f15de5211d89fcf63cdf2f6fa6.tar.gz | |
test_all.py: Use local modules instead of system ones if possible.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_all.py | 15 |
1 files changed, 15 insertions, 0 deletions
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]) |
