From 178bf6c4cbde8a3f66a1b8f018d7a950125eee84 Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 19 Nov 2012 14:16:39 +0000 Subject: * tests/test_aptsources.py: - Clean up file object in test_enable_component. --- tests/test_aptsources.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tests') 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") -- cgit v1.2.3