From 2de4b8dc146bcc6056434984fc7bb2d773c98645 Mon Sep 17 00:00:00 2001 From: Mikhail Korobov Date: Mon, 14 Jul 2014 18:00:20 +0600 Subject: [PATCH] TST clean temporary file explicitly --- scrapy/tests/test_commands.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scrapy/tests/test_commands.py b/scrapy/tests/test_commands.py index 08b8fc265..f7710f03b 100644 --- a/scrapy/tests/test_commands.py +++ b/scrapy/tests/test_commands.py @@ -26,10 +26,10 @@ class ProjectTest(unittest.TestCase): rmtree(self.temp_path) def call(self, *new_args, **kwargs): - out = tempfile.TemporaryFile() - args = (sys.executable, '-m', 'scrapy.cmdline') + new_args - return subprocess.call(args, stdout=out, stderr=out, cwd=self.cwd, \ - env=self.env, **kwargs) + with tempfile.TemporaryFile() as out: + args = (sys.executable, '-m', 'scrapy.cmdline') + new_args + return subprocess.call(args, stdout=out, stderr=out, cwd=self.cwd, + env=self.env, **kwargs) def proc(self, *new_args, **kwargs): args = (sys.executable, '-m', 'scrapy.cmdline') + new_args