Context: a directory, recursively containing python unittest.TestCase
s:
projectdir/build.xml
projectdir/src/x.java
projectdir/distribute/p.jar
projectdir/tests/a/test1.py
projectdir/tests/a/test2.py
projectdir/tests/b/test1.py
projectdir/tests/c/test1.py
projectdir/tests/javaunittests/test2.java
And I want ant to call
python -m unittest discover -s a b c
Now I was trying to convert a fileset
to the dirset
of the containing directories? The idea is to run python unittests:
<apply command="python">
<arg line="-m unittest"/>
<arg value="-s"/>
<dirset include="${python_unittests}"/>
</apply>
where ${python_unittests}" would refer to a
fileset` (but I don't find how) like this:
<fileset id="python_unittests" include="**/*.py">
<containsregexp expression="\(unittest.TestCase\)"/>
</fileset>
Or am I erring, and is there a better way to achieve this?
You want all python files with testcases, you don't need a dirset, use :
EDIT
Just checked the docs for unittest on python.org after your comment.
As i understand it, that should be sufficient :
as python docs section 26.3.3. Test Discovery explains :
I expect that discover works recursively starting from project_directory.