[PATCH] tests: create test directories under /tmp/kallithea_tests rather than /tmp

Thomas De Schampheleire patrickdepinguin at gmail.com
Mon May 11 15:28:04 EDT 2015


On Mon, May 11, 2015 at 1:09 AM, Mads Kiilerich <mads at kiilerich.com> wrote:
> On 05/10/2015 08:23 PM, Thomas De Schampheleire wrote:
>>
>> # HG changeset patch
>> # User Thomas De Schampheleire <thomas.de.schampheleire at gmail.com>
>> # Date 1431280346 -7200
>> #      Sun May 10 19:52:26 2015 +0200
>> # Node ID b4524d737ef6d0d22526075b113ebfe333a44271
>> # Parent  98c06fc800ed0f0635f3aa189177027b3f8e6c1f
>> tests: create test directories under /tmp/kallithea_tests rather than /tmp
>>
>> Do not pollute /tmp with tens of test directories.
>>
>> diff --git a/kallithea/tests/__init__.py b/kallithea/tests/__init__.py
>> --- a/kallithea/tests/__init__.py
>> +++ b/kallithea/tests/__init__.py
>> @@ -85,7 +85,7 @@ environ = {}
>>     #SOME GLOBALS FOR TESTS
>>   -TESTS_TMP_PATH = jn('/', 'tmp', 'rc_test_%s' %
>> _RandomNameSequence().next())
>> +TESTS_TMP_PATH = jn('/', 'tmp', 'kallithea_tests', 'rc_test_%s' %
>> _RandomNameSequence().next())
>
>
> That would do that different users can't run the tests on the same machine.
> We should probably add the uid to the tmp name, as in
> /tmp/kallithea_tests.1000/... .

Hmm, indeed. In fact, we could also use a random suffix in that
top-level directory, instead of the user id.

>
> (For weird reasons I feel like I would prefer to use '-' instead of '_' ...
> I don't know why or if it is relevant.)

No problem.

>
> IIRC, this is not enough to move _all_ output?
>
> Also, the real solution is to clean up, right? This is just a workaround?
> Might be worth mentioning in the commit message.

You're probably right. I must admit I did not investigate this in detail.
I think the correct approach is to let nosetests/py.test generate a
temp directory, and use any facilities in there to avoid them being in
/tmp directly.

I'll add it on my list to dig a little deeper...

Thanks,
Thomas


More information about the kallithea-general mailing list