mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-20 20:09:07 +00:00
Don't duplicate project root in tests
This commit is contained in:
parent
b21c9ebb43
commit
354ae119c6
@ -1,3 +1,4 @@
|
||||
import pytest
|
||||
import os
|
||||
import subprocess
|
||||
import shutil
|
||||
@ -5,9 +6,8 @@ from tempfile import mkdtemp
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import pexpect
|
||||
import pytest
|
||||
from tests.utils import root
|
||||
|
||||
root = str(Path(__file__).parent.parent.parent.resolve())
|
||||
bare = os.environ.get('BARE')
|
||||
enabled = os.environ.get('FUNCTIONAL')
|
||||
|
||||
@ -18,7 +18,7 @@ def build_container(tag, dockerfile):
|
||||
with Path(tmpdir).joinpath('Dockerfile').open('w') as file:
|
||||
file.write(dockerfile)
|
||||
if subprocess.call(['docker', 'build', '--tag={}'.format(tag), tmpdir],
|
||||
cwd=root) != 0:
|
||||
cwd=str(root)) != 0:
|
||||
raise Exception("Can't build a container")
|
||||
finally:
|
||||
shutil.rmtree(tmpdir)
|
||||
|
@ -1,12 +1,11 @@
|
||||
from pathlib import Path
|
||||
from tests.utils import root
|
||||
|
||||
|
||||
def test_readme():
|
||||
project_root = Path(__file__).parent.parent
|
||||
with project_root.joinpath('README.md').open() as f:
|
||||
with root.joinpath('README.md').open() as f:
|
||||
readme = f.read()
|
||||
|
||||
bundled = project_root \
|
||||
bundled = root \
|
||||
.joinpath('thefuck') \
|
||||
.joinpath('rules') \
|
||||
.glob('*.py')
|
||||
|
@ -1,3 +1,4 @@
|
||||
from pathlib import Path
|
||||
from thefuck import types
|
||||
from thefuck.conf import DEFAULT_PRIORITY
|
||||
|
||||
@ -19,3 +20,6 @@ def Rule(name='', match=lambda *_: True,
|
||||
|
||||
def CorrectedCommand(script='', side_effect=None, priority=DEFAULT_PRIORITY):
|
||||
return types.CorrectedCommand(script, side_effect, priority)
|
||||
|
||||
|
||||
root = Path(__file__).parent.parent.resolve()
|
||||
|
Loading…
x
Reference in New Issue
Block a user