New issue 530: add an option to run tests versus the WC, not the installed package https://bitbucket.org/hpk42/pytest/issue/530/add-an-option-to-run-tests-versus-the-wc
ccanepa: I see in issue https://bitbucket.org/hpk42/pytest/issue/54/ that currently the py.test way is holger krekel said """ The general strategy is to require "python setup.py develop" or "pip install -e ." when running tests, for the tests to find the code they are supposed to test. Otherwise it becomes hard to run the tests against an installed package which is something where py.test shouldn't get in the way. """ While this makes easy to test installed packages, it makes difficult to test without installing. It should be possible to support both ways, without damaging the stated philosophy. **Proposal** Add an option, say -d, such that * py.test ... has the actual behavior * py.test -d ... does the sys.path.insert(0, os.abspath(os.cwd()) thing The -d way supports the workflow * clone dev * hack, hack, py.test -d , hack, py.test -d * push While not touching the stable installation in python **Motivation** While it can be argued that dev should only happen on virtual envs, and that devs should not type in the wrong console :-), eventually bad things happen. **Keeping it simple** The description facing the user can be """ -d inserts the CWD at the beginning of sys.path, meaning tests will run against a local copy of package, if any. When the repository has a typical layout you have ``` cd checkout py.test -d ``` will test against the checked out version, without installing the package. To test the package as installed, you do ``` cd checkout pip install . py.test ``` the test will run against the *installed package*; the installation can be done with any variant of pip install or setup.py install. """ _______________________________________________ pytest-commit mailing list pytest-commit@python.org https://mail.python.org/mailman/listinfo/pytest-commit