mirror of
https://github.com/nvbn/thefuck.git
synced 2025-01-31 02:01:13 +00:00
#N/A Run functional tests in travis-ci
This commit is contained in:
parent
9e79c4aea3
commit
c6ec2df85b
@ -9,14 +9,15 @@ import pexpect
|
||||
import pytest
|
||||
|
||||
root = str(Path(__file__).parent.parent.parent.resolve())
|
||||
docker = os.environ.get('DOCKER', 'docker').split(' ')
|
||||
docker = os.environ.get('DOCKER', 'docker')
|
||||
|
||||
|
||||
def build_container(tag, dockerfile):
|
||||
tmpdir = mkdtemp()
|
||||
with Path(tmpdir).joinpath('Dockerfile').open('w') as file:
|
||||
file.write(dockerfile)
|
||||
if subprocess.call(['docker', 'build', '--tag={}'.format(tag), tmpdir],
|
||||
if subprocess.call(
|
||||
docker.split(' ') + ['build', '--tag={}'.format(tag), tmpdir],
|
||||
cwd=root) != 0:
|
||||
raise Exception("Can't build a container")
|
||||
shutil.rmtree(tmpdir)
|
||||
@ -27,7 +28,8 @@ def spawn(tag, dockerfile):
|
||||
tag = 'thefuck/{}'.format(tag)
|
||||
build_container(tag, dockerfile)
|
||||
proc = pexpect.spawnu(
|
||||
'docker run --volume {}:/src --tty=true --interactive=true {}'.format(root, tag))
|
||||
'{} run --volume {}:/src --tty=true --interactive=true {}'.format(
|
||||
docker, root, tag))
|
||||
proc.logfile = sys.stdout
|
||||
proc.sendline('pip install /src')
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user