Skip to content

Commit

Permalink
Remove runtests.py and run pytest directly (issue django-wiki#644):
Browse files Browse the repository at this point in the history
- Removed the runtests.py script.
- Updated manifest file to not include the removed script.
- Updated documentation to reference to direct use of the pytest
  command.
- Updated tox configuration to run pytest directly.
- Added documentation for the SELENIUM_SHOW_BROWSER environment
  variable.
- Updated testing documentation to mention that Xvfb must be available
  on the system as well for runing Selenium tests.
  • Loading branch information
azaghal committed Feb 14, 2018
1 parent ca44aab commit 0fecb80
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 67 deletions.
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
include COPYING
include README.rst
include setup.cfg
include runtests.py
recursive-include src *.html *.txt *.png *.js *.css *.gif *.less *.mo *.po *.otf *.svg *.woff *.woff2 *.eot *.ttf
prune src/wiki/attachments
prune src/wiki/images
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ lint: ## Check python code conventions
flake8 src/wiki tests/

test: ## Run automated test suite
./runtests.py
pytest

test-all: ## Run tests on all supported Python environments
tox
Expand Down
23 changes: 17 additions & 6 deletions docs/development/testing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,30 @@ Tests
Running tests
-------------

To run django-wiki's tests, run ``make test`` or ``./runtests.py``
To run django-wiki's tests, run ``make test`` or ``pytest``

If you want to test for more **environments**, install "tox"
(``pip install tox``) and then just run ``tox`` to run the test
suite on multiple environments.

To run **specific tests**, see ``./runtests.py --help``.
To run **specific tests**, see ``pytest --help``.

To include Selenium tests, you need to install `chromedriver
<https://sites.google.com/a/chromium.org/chromedriver/>`_ and run
``./runtests.py --include-selenium``. For tox, do::
To include Selenium tests, you need to have ``Xvfb`` installed
(usually via system-provided package manager), `chromedriver
<https://sites.google.com/a/chromium.org/chromedriver/>`_ and set the
environment variable ``INCLUDE_SELENIUM_TESTS=1``. For example, run
tests with (depending on whether you want to test directly or via
tox)::

INCLUDE_SELENIUM_TESTS=1 tox
INCLUDE_SELENIUM_TESTS=1 pytest
INCLUDE_SELENIUM_TESTS=1 tox

If you wish to also show the browser window while running the
functional tests, set the environment variable
``SELENIUM_SHOW_BROWSER=1`` in *addition* to
``INCLUDE_SELENIUM_TESTS=1``, for example::

INCLUDE_SELENIUM_TESTS=1 SELENIUM_SHOW_BROWSER=1 pytest


Writing tests
Expand Down
58 changes: 0 additions & 58 deletions runtests.py

This file was deleted.

2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ commands =
# Test that there are no migrations needed -- on Django 1.11, we can
# use --check and remove the '!' which likely doesn't work on Windows
sh -c '! testproject/manage.py makemigrations --dry-run --exit --noinput'
{toxinidir}/runtests.py --basetemp={envtmpdir} --ds=tests.settings --cov=src/wiki --cov-config .coveragerc {posargs}
pytest --basetemp={envtmpdir} --ds=tests.settings --cov=src/wiki --cov-config .coveragerc {posargs}

usedevelop = true

Expand Down

0 comments on commit 0fecb80

Please sign in to comment.