[TIP] testing setuptools-related code

Michael Foord michael at voidspace.org.uk
Thu Jan 19 07:30:03 PST 2012


On 19/01/2012 14:44, Andrea Crotti wrote:
> On 01/19/2012 02:35 PM, Andrea Crotti wrote:
>> I have (sadly) a special builder/runner that manages eggs and install 
>> eggs.
>> I've used the -m flag and I use pkg_resources to find the installed 
>> software,
>> but I didn't find a way to test everything..
>>
>> So what might be the easiest/portable solution to write some tests 
>> that for
>> example:
>>
>> - run the setuptools-based installer with the '-m'
>> - try to require it
>>
>> without interfering with the global environment?
>
> One possible idea (which might come handy also for other purposes) is 
> to use
> virtualenv, the problem is that I don't find any example where it's 
> actually used from
> other python scripts, without an actual shell interaction.
>
> I think something like this would be good:
>
>     virtualenv.create_environment(venv, site_packages=False, clear=False)
>     e = Egg(path.join('deps', 'app'))
>     e.develop()
>
> But I have to find a way to tell my code to pass to the Popen the 
> virtualenv activation,
> anyone already did it?

fabric has some virtualenv management functions which can be used in 
this way (create a virtualenv and execute commands within it).

Michael

>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
>


-- 
http://www.voidspace.org.uk/

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing http://www.sqlite.org/different.html




More information about the testing-in-python mailing list