[py-dev] py.test and darcs
holger krekel
hpk at trillke.net
Mon May 2 18:20:05 CEST 2005
Hi Michael, Hi Jan,
On Mon, May 02, 2005 at 15:48 +0200, Jan Balster wrote:
> Michael Twomey wrote:
> > Hi,
> >
> > I've been setting up a new pet project using py.test as the testing
> > framework, and darcs as the scm. I've hit a problem after my first
> > "darcs record" (darcs checkin). Darcs keeps a copy of the checked out
> > originals under a _darcs directory in the root of the source tree,
> > which causes py.test some confusion during the collect phase, since it
> > has duplicate python modules to contend with.
> >
> > Ideally I'd like py.test to ignore _darcs (and I think {arch} for GNU
> > arch too) out of the box, but is there a way to twist conftest.py's
> > arm to make it ignore these directories?
>
> Create a conftest.py with this content:
> ########################################################################
> import py
> class ExcludeDarcsDirectory(py.test.collect.Directory):
> def recfilter(self, path):
> return not path.check(fnmatch="_darcs*") and path.check(dotfile=0)
>
> Directory = ExcludeDarcsDirectory
> ########################################################################
Yes, that's fine, although
def recfilter(self, path):
if path.basename == '_darcs':
return False
return super(ExcludeDarcsDirectory, self).recfilter(path)
would be a more "defensive programming" style.
Michael, if you can investigate/double-check that '_darcs' is indeed
commonly used then i am happy to add it to the list of default
ignored directories.
cheers,
holger
More information about the Pytest-dev
mailing list