[TIP] including test files when running tox
holger at merlinux.eu
Tue Apr 10 21:03:38 PDT 2012
On Tue, Apr 10, 2012 at 10:45 -0700, Chris Jerdonek wrote:
> I am new to tox and have a question.
> My python project has files needed for testing that are not included
> when running (for example) "pip install". These include things like
> test data files outside the main package, sub-packages of the main
> package with modules containing unit tests, and packages outside the
> main package including python modules with test data.
> What is the recommended way to ensure that test-related files like
> these are available (and in the proper relative location) when running
it probably depends a bit on the test runner you are using.
data files: If you can instrument your test run by specifying data files
etc. on the command line then you can use tox's variables to point to
unittests-as-subpackages-of-main-packages: some people argue that such tests should be installed in which case you can just run them.
python modules with test data: not sure i understand - but with tox you
can just run them as part of your test commands.
Now, the interaction with 2to3 complicates the picture. I guess a more concrete example and the result of some trying to do things from your side might allow for more concrete suggestions.
> I'm using Distribute's `test` command to handle any conversion from
> Python 2 to 3 (as described here)--
> so it won't be necessary for tox to do any of those conversions.
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
More information about the testing-in-python