2015-09-07 12:12:16 +03:00
|
|
|
import pytest
|
2015-04-22 06:03:06 +02:00
|
|
|
from thefuck import logs
|
|
|
|
|
|
|
|
|
2015-09-07 12:12:16 +03:00
|
|
|
def test_color(settings):
|
|
|
|
settings.no_colors = False
|
|
|
|
assert logs.color('red') == 'red'
|
|
|
|
settings.no_colors = True
|
|
|
|
assert logs.color('red') == ''
|
2015-07-15 07:47:54 +03:00
|
|
|
|
|
|
|
|
2015-09-07 12:12:16 +03:00
|
|
|
@pytest.mark.usefixtures('no_colors')
|
|
|
|
@pytest.mark.parametrize('debug, stderr', [
|
|
|
|
(True, 'DEBUG: test\n'),
|
|
|
|
(False, '')])
|
|
|
|
def test_debug(capsys, settings, debug, stderr):
|
|
|
|
settings.debug = debug
|
|
|
|
logs.debug('test')
|
|
|
|
assert capsys.readouterr() == ('', stderr)
|