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:
19
19
- ' 3.6'
20
20
env :
21
21
global :
22
- - DISPLAY=:99.0
23
22
- GECKO_DRIVER_VERSION=v0.16.1
24
23
- CHROME_DRIVER_VERSION=2.29
25
24
matrix :
@@ -42,12 +41,10 @@ matrix:
42
41
install :
43
42
- pip install --upgrade pip tox
44
43
- pip install -U coveralls
45
- - sh -e /etc/init.d/xvfb start
46
44
before_script :
47
45
- mkdir bin
48
46
- curl -O https://chromedriver.storage.googleapis.com/${CHROME_DRIVER_VERSION}/chromedriver_linux64.zip
49
47
- 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
51
48
- PATH=$PATH:$PWD/bin
52
49
- |
53
50
if [[ -z $TOXENV ]]; then
Original file line number Diff line number Diff line change 3
3
4
4
import os
5
5
import tempfile
6
- from time import sleep
7
6
8
7
import pytest
9
8
from django .core .files .base import ContentFile
17
16
}
18
17
19
18
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' )
25
24
try :
26
- b = browsers [ request . param ]( )
25
+ b = webdriver . Chrome ( chrome_options = chrome_options )
27
26
except WebDriverException as e :
28
27
pytest .skip (force_text (e ))
29
28
else :
30
- b .set_window_size (1200 , 800 )
31
- b .implicitly_wait (0.1 )
32
29
yield b
33
- if isinstance (b , webdriver .Chrome ):
34
- # chrome needs a couple of seconds before it can be quit
35
- sleep (5 )
36
30
b .quit ()
37
31
38
32
You can’t perform that action at this time.
0 commit comments