From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 5627713888F for ; Fri, 30 Oct 2015 18:55:46 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E09C5E07F4; Fri, 30 Oct 2015 18:55:43 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 48E8CE07DF for ; Fri, 30 Oct 2015 18:55:43 +0000 (UTC) Received: from [10.128.12.146] (unknown [100.42.98.196]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: zmedico) by smtp.gentoo.org (Postfix) with ESMTPSA id 02F99340AB2 for ; Fri, 30 Oct 2015 18:55:41 +0000 (UTC) Subject: Re: [gentoo-portage-dev] [PATCH] runtests: create a global tempdir to hold subtest files To: gentoo-portage-dev@lists.gentoo.org References: <1446228019-5147-1-git-send-email-vapier@gentoo.org> <5633BC75.2010305@gentoo.org> From: Zac Medico Message-ID: <5633BD2C.8070300@gentoo.org> Date: Fri, 30 Oct 2015 11:55:40 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 In-Reply-To: <5633BC75.2010305@gentoo.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Archives-Salt: 14af091c-a97b-4528-8d7a-4106088c9b52 X-Archives-Hash: 8b86f0795125d53b5850bd81b990e4bc On 10/30/2015 11:52 AM, Zac Medico wrote: > On 10/30/2015 11:00 AM, Mike Frysinger wrote: > >> + try: >> + # Set up a single tempdir for all the tests to use. >> + # This way we know the tests won't leak things on us. >> + tempdir = tempfile.mkdtemp(prefix='portage.runtests.') > [snip] >> + finally: >> + if opts.keep_temp: >> + print('Temporary directory left behind:\n%s' % tempdir) >> + else: >> + # Nuke our tempdir and anything that might be under it. >> + shutil.rmtree(tempdir, True) >> >> # Then summarize it all. >> print('\nSummary:\n') >> > > This will raise NameError if mkdtemp for some reason. For absolute > correctness, you need to call mkdtemp before try, or set tempdir = None > before the try and check that it's not None before calling rmtree. > I mean, "if mkdtemp fails for some reason." Other then that issue, the patch looks good. -- Thanks, Zac