forked from mozilla/masterfirefoxos
-
Notifications
You must be signed in to change notification settings - Fork 3
/
conftest.py
28 lines (20 loc) · 886 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
import pytest
from django.conf import settings
def pytest_addoption(parser):
parser.addoption('--acceptance', action="store_true",
help="run acceptance tests")
parser.addoption('--baseurl', action='store', dest='base_url',
default='http://localhost:8000', metavar='url',
help='base url test against for acceptance tests')
def pytest_runtest_setup(item):
if 'acceptance' in item.keywords and not item.config.getoption(
"--acceptance"):
pytest.skip("need --acceptance option to run")
@pytest.fixture
def base_url(request):
return request.config.getoption('--baseurl')
@pytest.fixture
def base_urls(base_url):
return ['/'.join([base_url, locale, data['slug'], ''])
for version, data in settings.VERSIONS_LOCALE_MAP.items()
for locale in data['locales']]