forked from mozilla/mcom-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conftest.py
33 lines (27 loc) · 996 Bytes
/
conftest.py
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
import pytest
def pytest_addoption(parser):
parser.addoption(
'--bedrock',
action='store',
dest='bedrock',
metavar='bedrock',
help='marks tests so they use Bedrock branch')
parser.addoption(
'--skipsprod',
action='store',
dest='skipsprod',
metavar='skip',
help='marks tests as staging only and skips them on production')
def pytest_configure(config):
config.addinivalue_line(
'markers',
'bedrock: marks tests so they use Bedrock branch')
def pytest_runtest_setup(item):
if hasattr(item.obj, 'bedrock') and \
'/b' not in item.config.option.base_url:
item.config.option.base_url = item.config.option.base_url + '/b'
else:
item.config.option.base_url = item.config.option.base_url.replace('/b', '')
if hasattr(item.obj, 'skipsprod') \
and 'allizom.org' not in item.config.option.base_url:
pytest.skip("skipping tests marked staging only")