1 |
On 10/30/2015 11:52 AM, Zac Medico wrote: |
2 |
> On 10/30/2015 11:00 AM, Mike Frysinger wrote: |
3 |
> |
4 |
>> + try: |
5 |
>> + # Set up a single tempdir for all the tests to use. |
6 |
>> + # This way we know the tests won't leak things on us. |
7 |
>> + tempdir = tempfile.mkdtemp(prefix='portage.runtests.') |
8 |
> [snip] |
9 |
>> + finally: |
10 |
>> + if opts.keep_temp: |
11 |
>> + print('Temporary directory left behind:\n%s' % tempdir) |
12 |
>> + else: |
13 |
>> + # Nuke our tempdir and anything that might be under it. |
14 |
>> + shutil.rmtree(tempdir, True) |
15 |
>> |
16 |
>> # Then summarize it all. |
17 |
>> print('\nSummary:\n') |
18 |
>> |
19 |
> |
20 |
> This will raise NameError if mkdtemp for some reason. For absolute |
21 |
> correctness, you need to call mkdtemp before try, or set tempdir = None |
22 |
> before the try and check that it's not None before calling rmtree. |
23 |
> |
24 |
|
25 |
I mean, "if mkdtemp fails for some reason." Other then that issue, the |
26 |
patch looks good. |
27 |
-- |
28 |
Thanks, |
29 |
Zac |