summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2012-02-03 10:58:04 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2012-02-03 10:58:04 +0100
commit70e5581fa92082cc47ebadd0ae5e2cbcf928853d (patch)
tree4650dc2bdefd2daa248d266df7a806fa69e99e3d /tests
parentd3ea76a031fd9cb804741ec9955eccbbdb5f16f7 (diff)
downloadpython-apt-70e5581fa92082cc47ebadd0ae5e2cbcf928853d.tar.gz
tests/test_tagfile.py: fix data loading when not in tests dir
Diffstat (limited to 'tests')
-rw-r--r--tests/test_tagfile.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/test_tagfile.py b/tests/test_tagfile.py
index b0b5cbdc..b14dd9b4 100644
--- a/tests/test_tagfile.py
+++ b/tests/test_tagfile.py
@@ -7,6 +7,7 @@
# notice and this notice are preserved.
"""Unit tests for verifying the correctness of apt_pkg.TagFile"""
+import os
import unittest
from test_all import get_library_dir
@@ -19,13 +20,19 @@ class TestTagFile(unittest.TestCase):
""" test the apt_pkg.TagFile """
def test_tag_file(self):
- tagfile = apt_pkg.TagFile(open("./data/tagfile/history.log"))
+ basepath = os.path.dirname(__file__)
+ tagfilepath = os.path.join(
+ basepath, "./data/tagfile/history.log")
+ tagfile = apt_pkg.TagFile(open(tagfilepath))
for i, stanza in enumerate(tagfile):
pass
self.assertEqual(i, 2)
def test_tag_file_compressed(self):
- tagfile = apt_pkg.TagFile(open("./data/tagfile/history.1.log.gz"))
+ basepath = os.path.dirname(__file__)
+ tagfilepath = os.path.join(
+ basepath, "./data/tagfile/history.1.log.gz")
+ tagfile = apt_pkg.TagFile(open(tagfilepath))
for i, stanza in enumerate(tagfile):
#print stanza
pass