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