File tree Expand file tree Collapse file tree 2 files changed +6
-15
lines changed Expand file tree Collapse file tree 2 files changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,6 @@ python:
1919- ' 3.6'
2020env :
2121 global :
22- - DISPLAY=:99.0
2322 - GECKO_DRIVER_VERSION=v0.16.1
2423 - CHROME_DRIVER_VERSION=2.29
2524 matrix :
@@ -42,12 +41,10 @@ matrix:
4241install :
4342- pip install --upgrade pip tox
4443- pip install -U coveralls
45- - sh -e /etc/init.d/xvfb start
4644before_script :
4745- mkdir bin
4846- curl -O https://chromedriver.storage.googleapis.com/${CHROME_DRIVER_VERSION}/chromedriver_linux64.zip
4947- unzip chromedriver_linux64.zip -d bin
50- - curl -Lo - "https://github.com/mozilla/geckodriver/releases/download/${GECKO_DRIVER_VERSION}/geckodriver-${GECKO_DRIVER_VERSION}-linux64.tar.gz" | tar xzf - -C bin
5148- PATH=$PATH:$PWD/bin
5249- |
5350 if [[ -z $TOXENV ]]; then
Original file line number Diff line number Diff line change 33
44import os
55import tempfile
6- from time import sleep
76
87import pytest
98from django .core .files .base import ContentFile
1716}
1817
1918
20- @pytest .yield_fixture (scope = 'session' , params = sorted ( browsers . keys ()) )
21- def driver (request ):
22- if 'DISPLAY' not in os . environ :
23- pytest . skip ( 'Test requires display server (export DISPLAY) ' )
24-
19+ @pytest .yield_fixture (scope = 'session' )
20+ def driver ():
21+ chrome_options = webdriver . ChromeOptions ()
22+ chrome_options . add_argument ( 'headless ' )
23+ chrome_options . add_argument ( 'window-size=1200x800' )
2524 try :
26- b = browsers [ request . param ]( )
25+ b = webdriver . Chrome ( chrome_options = chrome_options )
2726 except WebDriverException as e :
2827 pytest .skip (force_text (e ))
2928 else :
30- b .set_window_size (1200 , 800 )
31- b .implicitly_wait (0.1 )
3229 yield b
33- if isinstance (b , webdriver .Chrome ):
34- # chrome needs a couple of seconds before it can be quit
35- sleep (5 )
3630 b .quit ()
3731
3832
You can’t perform that action at this time.
0 commit comments