diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-07-06 09:45:16 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-07-06 09:45:16 +0200 |
| commit | b94455e7afd0e08ce1a8aab890dbee0d42566d7b (patch) | |
| tree | 64f7e5bae5623eb97c8df3e05c127fd4a569f5d3 /tests | |
| parent | dd86db9ddb22b43867b5b4dc211f4440dec7aa6a (diff) | |
| download | python-apt-b94455e7afd0e08ce1a8aab890dbee0d42566d7b.tar.gz | |
fix debfile to work with py3, update tests
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test_all.py | 32 | ||||
| -rw-r--r-- | tests/test_debfile.py | 3 | ||||
| -rw-r--r-- | tests/test_debs/gdebi-test6.deb | bin | 4312 -> 600 bytes |
3 files changed, 22 insertions, 13 deletions
diff --git a/tests/test_all.py b/tests/test_all.py index d561a9ae..d6370747 100644 --- a/tests/test_all.py +++ b/tests/test_all.py @@ -9,21 +9,29 @@ import os import unittest import sys -if __name__ == '__main__': - sys.stderr.write("[tests] Running on %s\n" % sys.version.replace("\n", "")) - os.chdir(os.path.dirname(__file__)) +def get_library_dir(): # 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, + if not os.path.exists("../build"): + return None + 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 ""), + else: + library_dir = "../build/lib%s%s" % ((sys.pydebug and "_d" or ""), plat_specifier) + return os.path.abspath(library_dir) + +if __name__ == '__main__': + sys.stderr.write("[tests] Running on %s\n" % sys.version.replace("\n", "")) + dirname = os.path.dirname(__file__) + if dirname: + os.chdir(dirname) + library_dir = get_library_dir() + if library_dir: sys.path.insert(0, os.path.abspath(library_dir)) for path in os.listdir('.'): diff --git a/tests/test_debfile.py b/tests/test_debfile.py index 02e25117..56bbba9f 100644 --- a/tests/test_debfile.py +++ b/tests/test_debfile.py @@ -10,8 +10,9 @@ import os import logging import unittest +from test_all import get_library_dir import sys -sys.path.insert(0, "..") +sys.path.insert(0, get_library_dir()) import apt.debfile diff --git a/tests/test_debs/gdebi-test6.deb b/tests/test_debs/gdebi-test6.deb Binary files differindex 32fd1800..8ceacadc 100644 --- a/tests/test_debs/gdebi-test6.deb +++ b/tests/test_debs/gdebi-test6.deb |
