summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_all.py32
-rw-r--r--tests/test_debfile.py3
-rw-r--r--tests/test_debs/gdebi-test6.debbin4312 -> 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
index 32fd1800..8ceacadc 100644
--- a/tests/test_debs/gdebi-test6.deb
+++ b/tests/test_debs/gdebi-test6.deb
Binary files differ