Per-Project PyUnit Configuration

  • First, I would like to say great job with the new advanced unit-testing framework. Having the PyUnit view open at the right of my screen really encourages me to keep my tests up-to date, since all it takes is a single click to run them. The result display is really excellent!

    I wonder, though, as a future enhancement to PyDev, would it be possible to choose/configure the test runner on a per-project (or even per-run) basis? I have several different projects in my workspace, each with different unit testing needs. Pylons, for example, needs the -with-pylons=path/to/test.ini argument passed to nosetests, but my generic libraries do not. For now, I have to change the workspace configuration every time I want to test a different project.

    I tried adding arguments to the debug configuration for my unit test module, but it raised an exception:

    _pydev_getopt.GetoptError: option --with-pylons not recognized

    Anyway, just a thought. I hope it wouldn't be too complicated, because it would make a great new feature even better!



  • Fabio Zadrozny
    Fabio Zadrozny

    It shouldn't be hard. Please create a feature request for that.



  • xverges

    As a workaround for this, I'm trying using nose's


    switch, intending to use different config files for different projects.

    However, this is resulting harder than I expected since the working directory for the test runner seems to depend on the file being edited when the tests are launched. Is the some kind of variable substitution that I could use? Or some way to specify that I want tests to be always launched from a given project's directory?

    Thanks in advance.

  • Fabio Zadrozny
    Fabio Zadrozny

    You can change that for a given run configuration (but each new run configuration will always start with the working directory based on the file being run).

    On a separate note, in the current latest nightly build you can already override configurations for a given launch (but it's still not possible to override it on a per-project basis).