summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorColin Watson <cjwatson@canonical.com>2012-11-19 14:16:39 +0000
committerColin Watson <cjwatson@canonical.com>2012-11-19 14:16:39 +0000
commit178bf6c4cbde8a3f66a1b8f018d7a950125eee84 (patch)
tree962ac9a3002ca780ed6ab35ba6b4cc49a7f5bc1d /tests
parentb8ea5404dd387aa9f414a44113610d395777b778 (diff)
downloadpython-apt-178bf6c4cbde8a3f66a1b8f018d7a950125eee84.tar.gz
* tests/test_aptsources.py:
- Clean up file object in test_enable_component.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_aptsources.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py
index 41cfabb3..75dd91c1 100644
--- a/tests/test_aptsources.py
+++ b/tests/test_aptsources.py
@@ -164,7 +164,8 @@ class TestAptSources(unittest.TestCase):
from subprocess import Popen, PIPE
target = "./data/aptsources/sources.list.enable_comps"
line = "deb http://archive.ubuntu.com/ubuntu lucid main\n"
- open(target, "w").write(line)
+ with open(target, "w") as target_file:
+ target_file.write(line)
apt_pkg.config.set("Dir::Etc::sourcelist", target)
sources = aptsources.sourceslist.SourcesList(True, self.templates)
distro = aptsources.distro.get_distro(id="Ubuntu")