[TIP] data files for testing

Marius Gedminas marius at gedmin.as
Sun Dec 18 03:57:22 PST 2011


On Sun, Dec 18, 2011 at 11:29:59AM +0000, Andrea Crotti wrote:
> On 12/18/2011 12:50 AM, Marius Gedminas wrote:
> > On Sat, Dec 17, 2011 at 09:44:48PM +0000, Andrea Crotti wrote:
> >> Suppose I have some directories and files that I only use with my
> >> unit tests, now how should I address them?
> >> .
> >> I mean if for example I have
> >>
> >> package
> >>  - test
> >>    + fake_directory
> >>       + fake_data
> > I generally just put something like this into my test_whatever.py
> >
> >   here = os.path.dirname(__file__)
> >   fake_data_path = os.path.join(here, 'fake_directory', 'fake_data')
> >
> > This does not support zipped eggs, but zipped eggs aren't high on my
> > list of things I think I should support.
> 
> Thanks a lot that already solves my problems.
> In general I think I could also always include the tests, what I don't
> want to do is to rely on the fact that is installed just to run the
> tests, which doesn't seem very right..

Inserting an installation step between Edit and Test in the development
loop would be Bad.  On the other hand, you only need to run setup.py
develop once.  And since any nontrivial package probably includes
library dependencies, you most likely already need to set up a
virtualenv and run setup.py develop just to install those for
development.

Marius Gedminas
-- 
World domination.  Fast.
                -- Linus Torvalds
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20111218/499738f5/attachment.pgp>


More information about the testing-in-python mailing list