[TIP] pytest, making a standalone script with extensions

Michael Foord michael at voidspace.org.uk
Mon Dec 5 06:21:37 PST 2011


On 03/12/2011 17:17, francis wrote:
> Hi Michael,
> I appreciate your opinion in that question. Maybe I should have
> hat to ask: witch kind of new problems can arise from doing this,
> and maybe is worth a new thread but well, just to complement the
> info here:
>
> > In general the answer is no, bundling your dependencies is not
> > considered good practise. It puts code that isn't yours (and shouldn't
> > be modified) into your version control repository
>
> Modifying the code is sometimes necessary to be able to get a “feature”
> that only one wants (to get it better integrated with the actual 
> infrastructure
> or to be able to evolute it overtime into another one).

You will regret patching rather than extending every time you have to 
merge your changes into a new release...
>
> > and actively prevents  you from getting bug fixes or updates.
>
> Some times updates bring new features or new dependencies that one
> doesn't wants (or don't integrate very well). I prefer here to actively
> decide if the update is worth (not automatically).

Sure - pin your version in requirements.txt then.
>
> > One alternative is to run your own "mirror" of pypi for your specific
> > dependencies (it can actually just be a plain directory of files served
> > by Apache), updated from a cron job, and point pip at that. That allows
> > your infrastructure to be completely under your control and not be
> > dependent on an external resource (pypi). You do then have to manage
> > getting updated versions yourself.
> >
> That's a idea to be considered. In general I try to reduce dependencies
> as much as possible (if it can be done with the “included batteries”, 
> better)
> and having a standalone “test runner” into the repo makes the “checkout
> and test” IMHO easier.
>

Once your external dependency set is more than one the rationale for 
bundling dependencies evaporates.

All the best,

Michael

> cheers,
>
> francis
>


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