mirror of
https://github.com/nvbn/thefuck.git
synced 2025-09-27 23:52:41 +01:00
Use pytest-docker-pexpect
for func tests
This commit is contained in:
@@ -1,25 +1,26 @@
|
||||
import pytest
|
||||
from pexpect import TIMEOUT
|
||||
from tests.functional.utils import spawn, functional, bare
|
||||
from thefuck.main import _get_current_version
|
||||
from tests.functional.utils import functional
|
||||
|
||||
envs = ((u'bash', 'ubuntu-bash', u'''
|
||||
|
||||
envs = ((u'bash', 'thefuck/ubuntu-bash', u'''
|
||||
FROM ubuntu:latest
|
||||
RUN apt-get update
|
||||
RUN apt-get install -yy bash
|
||||
'''), (u'bash', 'generic-bash', u'''
|
||||
'''), (u'bash', 'thefuck/generic-bash', u'''
|
||||
FROM fedora:latest
|
||||
RUN dnf install -yy python-devel sudo wget gcc
|
||||
'''))
|
||||
|
||||
|
||||
@functional
|
||||
@pytest.mark.skipif(
|
||||
bool(bare), reason="Can't be tested in bare run")
|
||||
@pytest.mark.skip_without_docker
|
||||
@pytest.mark.parametrize('shell, tag, dockerfile', envs)
|
||||
def test_installation(request, shell, tag, dockerfile):
|
||||
proc = spawn(request, tag, dockerfile, shell, install=False)
|
||||
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'The Fuck'], timeout=600)
|
||||
assert proc.expect([TIMEOUT, u'thefuck {}'.format(_get_current_version())],
|
||||
timeout=600)
|
||||
proc.sendline(u'fuck')
|
||||
assert proc.expect([TIMEOUT, u'No fucks given'])
|
||||
|
Reference in New Issue
Block a user