public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Zac Medico <zmedico@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] [PATCH] runtests: create a global tempdir to hold subtest files
Date: Fri, 30 Oct 2015 11:55:40 -0700	[thread overview]
Message-ID: <5633BD2C.8070300@gentoo.org> (raw)
In-Reply-To: <5633BC75.2010305@gentoo.org>

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


  reply	other threads:[~2015-10-30 18:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-30 18:00 [gentoo-portage-dev] [PATCH] runtests: create a global tempdir to hold subtest files Mike Frysinger
2015-10-30 18:52 ` Zac Medico
2015-10-30 18:55   ` Zac Medico [this message]
2015-10-30 22:40 ` [gentoo-portage-dev] [PATCH v2] " Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5633BD2C.8070300@gentoo.org \
    --to=zmedico@gentoo.org \
    --cc=gentoo-portage-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox