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,15 +9,16 @@ import pexpect
|
|||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
root = str(Path(__file__).parent.parent.parent.resolve())
|
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):
|
def build_container(tag, dockerfile):
|
||||||
tmpdir = mkdtemp()
|
tmpdir = mkdtemp()
|
||||||
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(
|
||||||
cwd=root) != 0:
|
docker.split(' ') + ['build', '--tag={}'.format(tag), tmpdir],
|
||||||
|
cwd=root) != 0:
|
||||||
raise Exception("Can't build a container")
|
raise Exception("Can't build a container")
|
||||||
shutil.rmtree(tmpdir)
|
shutil.rmtree(tmpdir)
|
||||||
|
|
||||||
@ -27,7 +28,8 @@ def spawn(tag, dockerfile):
|
|||||||
tag = 'thefuck/{}'.format(tag)
|
tag = 'thefuck/{}'.format(tag)
|
||||||
build_container(tag, dockerfile)
|
build_container(tag, dockerfile)
|
||||||
proc = pexpect.spawnu(
|
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.logfile = sys.stdout
|
||||||
proc.sendline('pip install /src')
|
proc.sendline('pip install /src')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user