forked from BoboTiG/python-mss
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
36 lines (23 loc) · 726 Bytes
/
conftest.py
File metadata and controls
36 lines (23 loc) · 726 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# coding: utf-8
from os import environ
import pytest
from mss import mss
def pytest_addoption(parser):
txt = 'Display to use (examples: ":0.1", ":0" [default])'
parser.addoption('--display', action='store', default=':0', help=txt)
@pytest.fixture(scope='session')
def display(request):
return request.config.getoption('--display')
@pytest.fixture(scope='module')
def sct(display):
try:
# display keyword is only for GNU/Linux
return mss(display=display)
except TypeError:
return mss()
@pytest.fixture(scope='session')
def is_travis():
return 'TRAVIS' in environ
@pytest.fixture(scope='session')
def raw():
return open('tests/monitor-1024x768.raw', 'rb').read()