Skip to content
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
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ python:
- '3.6'
env:
global:
- DISPLAY=:99.0
- GECKO_DRIVER_VERSION=v0.16.1
- CHROME_DRIVER_VERSION=2.29
matrix:
Expand All @@ -42,12 +41,10 @@ matrix:
install:
- pip install --upgrade pip tox
- pip install -U coveralls
- sh -e /etc/init.d/xvfb start
before_script:
- mkdir bin
- curl -O https://chromedriver.storage.googleapis.com/${CHROME_DRIVER_VERSION}/chromedriver_linux64.zip
- unzip chromedriver_linux64.zip -d bin
- curl -Lo - "https://github.com/mozilla/geckodriver/releases/download/${GECKO_DRIVER_VERSION}/geckodriver-${GECKO_DRIVER_VERSION}-linux64.tar.gz" | tar xzf - -C bin
- PATH=$PATH:$PWD/bin
- |
if [[ -z $TOXENV ]]; then
Expand Down
18 changes: 6 additions & 12 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import os
import tempfile
from time import sleep

import pytest
from django.core.files.base import ContentFile
Expand All @@ -17,22 +16,17 @@
}


@pytest.yield_fixture(scope='session', params=sorted(browsers.keys()))
def driver(request):
if 'DISPLAY' not in os.environ:
pytest.skip('Test requires display server (export DISPLAY)')

@pytest.yield_fixture(scope='session')
def driver():
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('headless')
chrome_options.add_argument('window-size=1200x800')
try:
b = browsers[request.param]()
b = webdriver.Chrome(chrome_options=chrome_options)
except WebDriverException as e:
pytest.skip(force_text(e))
else:
b.set_window_size(1200, 800)
b.implicitly_wait(0.1)
yield b
if isinstance(b, webdriver.Chrome):
# chrome needs a couple of seconds before it can be quit
sleep(5)
b.quit()


Expand Down