From 70e5581fa92082cc47ebadd0ae5e2cbcf928853d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 3 Feb 2012 10:58:04 +0100 Subject: tests/test_tagfile.py: fix data loading when not in tests dir --- tests/test_tagfile.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'tests') 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 -- cgit v1.2.3