mercredi 14 septembre 2016

Is there a standard way to tell py.test to run against specific code?

I'm trying to run a Python project's unit tests using py.test. Until recently I've used nose and it ran the tests against my local source code instead of the installed package, but py.test seems to want to run against the installed package, meaning I have to run python setup.py install before every test run.

The project is organized like so:

/project
    /project  
        __init__.py
        project_file.py
    /test
        __init__.py
        /test_project
            test_project_file.py

The only way I've found to get py.test to run against the local code is to run python -m pytest in the top /project folder. It's very strange, as running py.test in the same location runs against the installed code. --version is the same for both.

Is there a standard way to tell py.test to run against specific code? I haven't been able to find a clear answer in py.test's documentation.

Aucun commentaire:

Enregistrer un commentaire