Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow more control over tox Selenium tests #1897

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ or by setting the ``DJANGO_SELENIUM_TESTS`` environment variable::
$ DJANGO_SELENIUM_TESTS=true make coverage
$ DJANGO_SELENIUM_TESTS=true tox

Note that by default, ``tox`` enables the Selenium tests for a single test
environment. To run the entire ``tox`` test suite with all Selenium tests
disabled, run the following::

$ DJANGO_SELENIUM_TESTS= tox

To test via ``tox`` against other databases, you'll need to create the user,
database and assign the proper permissions. For PostgreSQL in a ``psql``
shell (note this allows the debug_toolbar user the permission to create
Expand Down
2 changes: 1 addition & 1 deletion tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ def test_auth_login_view_without_redirect(self):

@unittest.skipIf(webdriver is None, "selenium isn't installed")
@unittest.skipUnless(
"DJANGO_SELENIUM_TESTS" in os.environ, "selenium tests not requested"
os.environ.get("DJANGO_SELENIUM_TESTS"), "selenium tests not requested"
)
@override_settings(DEBUG=True)
class DebugToolbarLiveTestCase(StaticLiveServerTestCase):
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ passenv=
setenv =
PYTHONPATH = {toxinidir}
PYTHONWARNINGS = d
py311-dj42-postgresql: DJANGO_SELENIUM_TESTS = true
py311-dj42-postgresql: DJANGO_SELENIUM_TESTS = {env:DJANGO_SELENIUM_TESTS:true}
DB_NAME = {env:DB_NAME:debug_toolbar}
DB_USER = {env:DB_USER:debug_toolbar}
DB_HOST = {env:DB_HOST:localhost}
Expand Down