From 2b608b402ebd894c1d1e49f50a235f09360baa3b Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sat, 20 Jan 2018 07:57:27 -0800 Subject: [PATCH] Avoid installing package in editable mode for testing No longer need to install the django-debug-toolbar package itself for testing. Modern Python and Django can use the -m command line argument to execute the Django module entry point. Allows for simpler test setup and less manipulation of the local environment. --- Makefile | 12 ++++++------ docs/contributing.rst | 4 ++-- example/README.rst | 4 ++-- requirements_dev.txt | 4 ---- tox.ini | 1 - 5 files changed, 10 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 1cb754a9a..9e5c84186 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ isort_check_only: example: DJANGO_SETTINGS_MODULE=example.settings \ - django-admin runserver + python -m django runserver jshint: node_modules/jshint/bin/jshint ./node_modules/jshint/bin/jshint debug_toolbar/static/debug_toolbar/js/*.js @@ -21,24 +21,24 @@ node_modules/jshint/bin/jshint: test: DJANGO_SETTINGS_MODULE=tests.settings \ - django-admin test $${TEST_ARGS:-tests} + python -m django test $${TEST_ARGS:-tests} test_selenium: DJANGO_SELENIUM_TESTS=true DJANGO_SETTINGS_MODULE=tests.settings \ - django-admin test $${TEST_ARGS:-tests} + python -m django test $${TEST_ARGS:-tests} coverage: python --version coverage erase DJANGO_SETTINGS_MODULE=tests.settings \ - coverage run `which django-admin` test -v2 $${TEST_ARGS:-tests} + coverage run -m django test -v2 $${TEST_ARGS:-tests} coverage report coverage html translatable_strings: - cd debug_toolbar && django-admin makemessages -l en --no-obsolete + cd debug_toolbar && python -m django makemessages -l en --no-obsolete @echo "Please commit changes and run 'tx push -s' (or wait for Transifex to pick them)" update_translations: tx pull -a --minimum-perc=10 - cd debug_toolbar && django-admin compilemessages + cd debug_toolbar && python -m django compilemessages diff --git a/docs/contributing.rst b/docs/contributing.rst index c8277677d..3065a6963 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -32,8 +32,8 @@ the libraries required for working on the Debug Toolbar:: You can run now run the example application:: - $ DJANGO_SETTINGS_MODULE=example.settings django-admin migrate - $ DJANGO_SETTINGS_MODULE=example.settings django-admin runserver + $ DJANGO_SETTINGS_MODULE=example.settings python -m django migrate + $ DJANGO_SETTINGS_MODULE=example.settings python -m django runserver For convenience, there's an alias for the second command:: diff --git a/example/README.rst b/example/README.rst index 886ee0655..e87563ebf 100644 --- a/example/README.rst +++ b/example/README.rst @@ -22,8 +22,8 @@ the debug toolbar, ie. the directory that contains ``example/``. Before running the example for the first time, you must create a database:: - $ PYTHONPATH=. django-admin migrate --settings=example.settings + $ python -m django migrate --settings=example.settings Then you can use the following command to run the example:: - $ PYTHONPATH=. django-admin runserver --settings=example.settings + $ python -m django runserver --settings=example.settings diff --git a/requirements_dev.txt b/requirements_dev.txt index 7b3c6e6b3..cc3c9afcd 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,7 +1,3 @@ -# The debug toolbar itself - --e . - # Runtime dependencies Django diff --git a/tox.ini b/tox.ini index 5a26b5c53..3f5e901d6 100644 --- a/tox.ini +++ b/tox.ini @@ -19,7 +19,6 @@ setenv = PYTHONPATH = {toxinidir} whitelist_externals = make pip_pre = True -usedevelop = true commands = make coverage TEST_ARGS='{posargs:tests}' [testenv:flake8]