[TIP] tox and setup.py

Michael Foord michael at voidspace.org.uk
Sat Jun 25 04:29:29 PDT 2011


On 24/06/2011 22:16, Jorge Cardona wrote:
> On Fri, Jun 24, 2011 at 12:33 PM, Michael Foord
> <michael at voidspace.org.uk>  wrote:
>> On 24/06/2011 17:39, Jorge Cardona wrote:
>>> On Fri, Jun 24, 2011 at 7:01 AM, Michael Foord<michael at voidspace.org.uk>
>>>   wrote:
>>>> On 24/06/2011 03:58, Jorge Cardona wrote:
>>>>> Hi,
>>>>>
>>>>> I have set a tox.ini with a setup.py which describe a python package
>>>>> and I tested it with tox, the first step is to create a sdist in zip
>>>>> format of the package, but I need to change the version to refresh the
>>>>> zip every time I want to test the code, there is a way to test it
>>>>> without change the package version every time?
>>>>>
>>>> By default tox will recreate the sdist, for the main package under test,
>>>> every time. Are you sure this isn't happening, or is this particular
>>>> setup.py for a dependency rather than the main package?
>>>>
>>> The setup.py is for the main package. But I just check and the zip
>>> file is correctly refresh by setup.py sdist, but tox doesn't refresh
>>> the installation, I know there is a way to force the refresh of the
>>> environment, but that takes so much time and every little change that
>>> I want to test would be pretty long.
>> Yeah, you don't need to refresh the environment just to test the current
>> version of your package under test.
>>
>> Can you paste your tox.ini to the list?
>>
> [testenv:local]
> changedir = tests/proj
> commands = python manage.py test core
> deps =
>      django
>      nose
>      django-nose
>      git+git://github.com/jorgeecardona/nosecover3.git
>      coverage
>

And I take it that nosecover3 is *not* the project you are testing? You 
don't need to list the project you're testing as a dependency.

If that isn't the problem then I'm not sure what it would be.

All the best,

Michael Foord

> (Sorry michael for the duplicated message)
>
>> Michael
>>
>>> Check the installation logs after a change, first without change the
>>> version:
>>>
>>> user at machone:<path>$ cat .tox/local/log/22.log
>>> <path>/.tox/local/log$ ../bin/pip install
>>> --download-cache=<path>/.tox/_download ../../dist/<package>-1.0.4.zip
>>>> 22.log
>>> Unpacking<path>/.tox/dist/<package>-1.0.4.zip
>>>    Running setup.py egg_info for package from
>>> file:///<path>/.tox/dist/<package>1.0.4.zip
>>> Cleaning up...
>>>
>>> And after the version change:
>>>
>>> user at machone:<path>$ cat .tox/local/log/23.log
>>> <path>/.tox/local/log$ ../bin/pip install
>>> --download-cache=<path>/.tox/_download ../../dist/<package>-1.0.5.zip
>>>> 23.log
>>> Unpacking<path>/.tox/dist/<package>-1.0.5.zip
>>>    Running setup.py egg_info for package from
>>> file://<path>/.tox/dist/<package>-1.0.5.zip
>>> Installing collected packages:<package>
>>>    Found existing installation:<package>    1.0.4
>>>      Uninstalling<package>:
>>>        Successfully uninstalled<package>
>>>    Running setup.py install for<package>
>>> Successfully installed<package>
>>> Cleaning up...
>>>
>>> Look that the way in which pip is called doesn't update the package,
>>> I'm using tox 1.0, there is a way to add a single -U to that command?
>>>
>>>> (I use tox for mock and run tests in between minor edits without bumping
>>>> the
>>>> version number. It builds a fresh sdist and installs it into the
>>>> virtualenvironments every time.)
>>>>
>>> Mmm, that's what I want to do. :(
>>>
>>>> All the best,
>>>>
>>>> Michael
>>>>
>>>>> Thanks.
>>>>>
>>>> --
>>>> 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
>>>>
>>>>
>>>
>>
>> --
>> 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
>>
>>
>
>


-- 
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