1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-06 02:41:10 +01:00
thefuck/tests/conftest.py

38 lines
976 B
Python
Raw Normal View History

2015-07-10 15:58:41 +01:00
import pytest
2015-09-07 10:12:16 +01:00
from thefuck import conf
2015-07-10 15:58:41 +01:00
2015-09-05 23:13:44 +01:00
def pytest_addoption(parser):
"""Adds `--run-without-docker` argument."""
group = parser.getgroup("thefuck")
group.addoption('--enable-functional', action="store_true", default=False,
help="Enable functional tests")
2015-07-10 15:58:41 +01:00
@pytest.fixture
def no_memoize(monkeypatch):
monkeypatch.setattr('thefuck.utils.memoize.disabled', True)
2015-09-07 10:12:16 +01:00
@pytest.fixture(autouse=True)
def settings(request):
request.addfinalizer(lambda: conf.settings.update(conf.DEFAULT_SETTINGS))
return conf.settings
@pytest.fixture
2015-09-07 10:12:16 +01:00
def no_colors(settings):
settings.no_colors = True
2015-09-02 09:10:03 +01:00
@pytest.fixture(autouse=True)
def no_cache(monkeypatch):
monkeypatch.setattr('thefuck.utils.cache.disabled', True)
2015-09-05 23:13:44 +01:00
@pytest.fixture(autouse=True)
def functional(request):
if request.node.get_marker('functional') \
and not request.config.getoption('enable_functional'):
pytest.skip('functional tests are disabled')