[py-dev] py.test and darcs

Jan Balster jan at balster.info
Mon May 2 15:48:25 CEST 2005


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

You can find a more sophisticated example of a custom Collector in
py/documentation/conftest.py.

Have a nice day
Jan




More information about the Pytest-dev mailing list