Skip to content

Commit

Permalink
restructure tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dakrauth committed Jul 8, 2021
1 parent fc258df commit 3f01d2d
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ jobs:
pip install tox tox-gh-actions
- name: Test with tox
run: |
tox -- -v --selenium=chrome-headless || \
tox -- -v --selenium=chrome-headless || \
tox -- -v --selenium=chrome-headless
tox -- -v2 --selenium=chrome-headless || \
tox -- -v2 --selenium=chrome-headless || \
tox -- -v2 --selenium=chrome-headless
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ dist/
chromedriver
chromedriver_mac64.zip
README.html
venv
.venv
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ You can use homebrew or manually download ``chomedriver``:

2. Manually::

export PATH="$PWD:$PATH"
export CHROMEDRIVER_VERSION=$(curl -q http://chromedriver.storage.googleapis.com/LATEST_RELEASE)
curl -O http://chromedriver.storage.googleapis.com/$CHROMEDRIVER_VERSION/chromedriver_mac64.zip
unzip chromedriver_mac64.zip
Expand Down
8 changes: 6 additions & 2 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
def main():
warnings.simplefilter("error", Warning)

warnings.filterwarnings(
'once',
message="'grappelli' defines default_app_config"
)

# Introduced in Python 3.7
warnings.filterwarnings(
'ignore',
Expand All @@ -16,8 +21,7 @@ def main():
)

os.environ.setdefault('DJANGO_LIVE_TEST_SERVER_ADDRESS', 'localhost:8081-8089')
runtests = selenosis.RunTests(
"selenosis.tests.settings", "selenosis")
runtests = selenosis.RunTests("tests.settings", "tests")
runtests()


Expand Down
4 changes: 2 additions & 2 deletions selenosis/pytest_plugin/selenosis.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def __call__(self, parser, namespace, values, option_string=None):

if not browsers:
try:
SelenosisTestCaseBase.import_webdriver('phantomjs')
SelenosisTestCaseBase.import_webdriver('chrome-headless')
except:
browsers = ['skip']
else:
browsers = ['phantomjs']
browsers = ['chrome-headless']

SelenosisTestCaseBase.browsers = browsers

Expand Down
6 changes: 3 additions & 3 deletions selenosis/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ def __init__(self, **kwargs):
browsers = kwargs.pop('selenium', None)
if not browsers:
try:
SelenosisTestCaseBase.import_webdriver('phantomjs')
SelenosisTestCaseBase.import_webdriver('chrome-headless')
except:
browsers = ['skip']
else:
browsers = ['phantomjs']
browsers = ['chrome-headless']
SelenosisTestCaseBase.browsers = browsers
if not DJANGO_NATIVE_TAG_SUPPORT:
self.tags = set(kwargs.pop('tags', None) or [])
Expand All @@ -118,7 +118,7 @@ def add_arguments(cls, parser):
parser.add_argument(
'--selenium', action=ActionSelenosis, metavar='BROWSERS',
help='A comma-separated list of browsers to run the Selenosis '
'tests against. Defaults to "phantomjs".')
'tests against. Defaults to "chrome-headless".')
parser.add_argument(
'--%slog-by-verbosity' % ('no-' if cls.default_log_by_verbosity else ''),
action=('store_false' if cls.default_log_by_verbosity else 'store_false'),
Expand Down
4 changes: 0 additions & 4 deletions selenosis/tests/settings.py

This file was deleted.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def read(*parts):
author_email='[email protected]',
maintainer='Frankie Dintino',
maintainer_email='[email protected]',
packages=find_packages(),
packages=find_packages(exclude=['tests']),
include_package_data=True,
zip_safe=False,
install_requires=['Django>=2.2',],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from selenosis.settings import * # noqa


INSTALLED_APPS += ('tests',) # noqa
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ commands =
python runtests.py {posargs}
passenv =
deps =
pytest
pytest-django
selenium==3.141.0
dj22: Django>=2.2,<3.0
dj31: Django>=3.1,<3.2
Expand Down

0 comments on commit 3f01d2d

Please sign in to comment.