Changeset View
Changeset View
Standalone View
Standalone View
swh/core/tests/fixture/test_pytest_plugin.py
# Copyright (C) 2019 The Software Heritage developers | # Copyright (C) 2019 The Software Heritage developers | ||||
# See the AUTHORS file at the top-level directory of this distribution | # See the AUTHORS file at the top-level directory of this distribution | ||||
# License: GNU General Public License version 3, or any later version | # License: GNU General Public License version 3, or any later version | ||||
# See top-level LICENSE file for more information | # See top-level LICENSE file for more information | ||||
import requests | import requests | ||||
from .conftest import DATADIR | from .conftest import DATADIR | ||||
# In this arborescence, we override in the local conftest.py module the | # In this arborescence, we override in the local conftest.py module the | ||||
# "datadir" fixture to specify where to retrieve the data files from. | # "datadir" fixture to specify where to retrieve the data files from. | ||||
def test_requests_mock_datadir_with_datadir_fixture_override( | def test_requests_mock_datadir_with_datadir_fixture_override(requests_mock_datadir): | ||||
requests_mock_datadir): | |||||
"""Override datadir fixture should retrieve data from elsewhere | """Override datadir fixture should retrieve data from elsewhere | ||||
""" | """ | ||||
response = requests.get('https://example.com/file.json') | response = requests.get('https://example.com/file.json') | ||||
assert response.ok | assert response.ok | ||||
assert response.json() == {'welcome': 'you'} | assert response.json() == {'welcome': 'you'} | ||||
def test_data_dir_override(datadir): | def test_data_dir_override(datadir): | ||||
assert datadir == DATADIR | assert datadir == DATADIR |