Minor refactoring
This commit is contained in:
@@ -41,3 +41,8 @@ def functional(request):
|
||||
if request.node.get_marker('functional') \
|
||||
and not request.config.getoption('enable_functional'):
|
||||
pytest.skip('functional tests are disabled')
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def source_root():
|
||||
return Path(__file__).parent.parent.resolve()
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import pytest
|
||||
from thefuck.main import _get_current_version
|
||||
from thefuck.utils import get_installation_info
|
||||
|
||||
envs = ((u'bash', 'thefuck/ubuntu-bash', u'''
|
||||
FROM ubuntu:latest
|
||||
@@ -18,7 +18,8 @@ def test_installation(spawnu, shell, TIMEOUT, tag, dockerfile):
|
||||
proc = spawnu(tag, dockerfile, shell)
|
||||
proc.sendline(u'cat /src/install.sh | sh - && $0')
|
||||
proc.sendline(u'thefuck --version')
|
||||
assert proc.expect([TIMEOUT, u'thefuck {}'.format(_get_current_version())],
|
||||
version = get_installation_info().version
|
||||
assert proc.expect([TIMEOUT, u'thefuck {}'.format(version)],
|
||||
timeout=600)
|
||||
proc.sendline(u'fuck')
|
||||
assert proc.expect([TIMEOUT, u'No fucks given'])
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
from tests.utils import root
|
||||
|
||||
|
||||
def test_readme():
|
||||
with root.joinpath('README.md').open() as f:
|
||||
def test_readme(source_root):
|
||||
with source_root.joinpath('README.md').open() as f:
|
||||
readme = f.read()
|
||||
|
||||
bundled = root \
|
||||
.joinpath('thefuck') \
|
||||
.joinpath('rules') \
|
||||
.glob('*.py')
|
||||
bundled = source_root.joinpath('thefuck') \
|
||||
.joinpath('rules') \
|
||||
.glob('*.py')
|
||||
|
||||
for rule in bundled:
|
||||
if rule.stem != '__init__':
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
from pathlib import Path
|
||||
from thefuck import types
|
||||
from thefuck.conf import DEFAULT_PRIORITY
|
||||
|
||||
@@ -24,6 +23,3 @@ class CorrectedCommand(types.CorrectedCommand):
|
||||
def __init__(self, script='', side_effect=None, priority=DEFAULT_PRIORITY):
|
||||
super(CorrectedCommand, self).__init__(
|
||||
script, side_effect, priority)
|
||||
|
||||
|
||||
root = Path(__file__).parent.parent.resolve()
|
||||
|
||||
Reference in New Issue
Block a user