mirror of
https://github.com/nvbn/thefuck.git
synced 2025-02-07 13:41:21 +00:00
Add functional
marker
This commit is contained in:
parent
8cc19daaaa
commit
cdd5f21e88
@ -1,4 +1,5 @@
|
|||||||
language: python
|
language: python
|
||||||
|
sudo: false
|
||||||
python:
|
python:
|
||||||
- "3.4"
|
- "3.4"
|
||||||
- "3.3"
|
- "3.3"
|
||||||
@ -14,8 +15,6 @@ addons:
|
|||||||
- tcsh
|
- tcsh
|
||||||
- pandoc
|
- pandoc
|
||||||
- git
|
- git
|
||||||
env:
|
|
||||||
- FUNCTIONAL=true
|
|
||||||
install:
|
install:
|
||||||
- pip install coveralls
|
- pip install coveralls
|
||||||
- pip install -r requirements.txt
|
- pip install -r requirements.txt
|
||||||
@ -23,5 +22,5 @@ install:
|
|||||||
- rm -rf build
|
- rm -rf build
|
||||||
script:
|
script:
|
||||||
- export COVERAGE_PYTHON_VERSION=python-${TRAVIS_PYTHON_VERSION:0:1}
|
- export COVERAGE_PYTHON_VERSION=python-${TRAVIS_PYTHON_VERSION:0:1}
|
||||||
- coverage run --source=thefuck,tests -m py.test -v --capture=sys --run-without-docker
|
- coverage run --source=thefuck,tests -m py.test -v --capture=sys --run-without-docker --enable-functional
|
||||||
after_success: coveralls
|
after_success: coveralls
|
||||||
|
@ -326,7 +326,7 @@ py.test
|
|||||||
Run unit and functional tests (requires docker):
|
Run unit and functional tests (requires docker):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
FUNCTIONAL=true py.test
|
py.test --enable-functional
|
||||||
```
|
```
|
||||||
|
|
||||||
For sending package to pypi:
|
For sending package to pypi:
|
||||||
|
@ -2,6 +2,13 @@ import pytest
|
|||||||
from mock import Mock
|
from mock import Mock
|
||||||
|
|
||||||
|
|
||||||
|
def pytest_addoption(parser):
|
||||||
|
"""Adds `--run-without-docker` argument."""
|
||||||
|
group = parser.getgroup("thefuck")
|
||||||
|
group.addoption('--enable-functional', action="store_true", default=False,
|
||||||
|
help="Enable functional tests")
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def no_memoize(monkeypatch):
|
def no_memoize(monkeypatch):
|
||||||
monkeypatch.setattr('thefuck.utils.memoize.disabled', True)
|
monkeypatch.setattr('thefuck.utils.memoize.disabled', True)
|
||||||
@ -15,3 +22,10 @@ def settings():
|
|||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def no_cache(monkeypatch):
|
def no_cache(monkeypatch):
|
||||||
monkeypatch.setattr('thefuck.utils.cache.disabled', True)
|
monkeypatch.setattr('thefuck.utils.cache.disabled', True)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture(autouse=True)
|
||||||
|
def functional(request):
|
||||||
|
if request.node.get_marker('functional') \
|
||||||
|
and not request.config.getoption('enable_functional'):
|
||||||
|
pytest.skip('functional tests are disabled')
|
||||||
|
@ -2,7 +2,6 @@ import pytest
|
|||||||
from tests.functional.plots import with_confirmation, without_confirmation, \
|
from tests.functional.plots import with_confirmation, without_confirmation, \
|
||||||
refuse_with_confirmation, history_changed, history_not_changed, \
|
refuse_with_confirmation, history_changed, history_not_changed, \
|
||||||
select_command_with_arrows
|
select_command_with_arrows
|
||||||
from tests.functional.utils import functional
|
|
||||||
|
|
||||||
containers = ((u'thefuck/ubuntu-python3-bash',
|
containers = ((u'thefuck/ubuntu-python3-bash',
|
||||||
u'''FROM ubuntu:latest
|
u'''FROM ubuntu:latest
|
||||||
@ -30,25 +29,25 @@ def proc(request, spawnu, run_without_docker):
|
|||||||
return proc
|
return proc
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
def test_with_confirmation(proc, TIMEOUT):
|
def test_with_confirmation(proc, TIMEOUT):
|
||||||
with_confirmation(proc, TIMEOUT)
|
with_confirmation(proc, TIMEOUT)
|
||||||
history_changed(proc, TIMEOUT, u'echo test')
|
history_changed(proc, TIMEOUT, u'echo test')
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
def test_select_command_with_arrows(proc, TIMEOUT):
|
def test_select_command_with_arrows(proc, TIMEOUT):
|
||||||
select_command_with_arrows(proc, TIMEOUT)
|
select_command_with_arrows(proc, TIMEOUT)
|
||||||
history_changed(proc, TIMEOUT, u'git push')
|
history_changed(proc, TIMEOUT, u'git push')
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
def test_refuse_with_confirmation(proc, TIMEOUT):
|
def test_refuse_with_confirmation(proc, TIMEOUT):
|
||||||
refuse_with_confirmation(proc, TIMEOUT)
|
refuse_with_confirmation(proc, TIMEOUT)
|
||||||
history_not_changed(proc, TIMEOUT)
|
history_not_changed(proc, TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
def test_without_confirmation(proc, TIMEOUT):
|
def test_without_confirmation(proc, TIMEOUT):
|
||||||
without_confirmation(proc, TIMEOUT)
|
without_confirmation(proc, TIMEOUT)
|
||||||
history_changed(proc, TIMEOUT, u'echo test')
|
history_changed(proc, TIMEOUT, u'echo test')
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from tests.functional.plots import with_confirmation, without_confirmation, \
|
from tests.functional.plots import with_confirmation, without_confirmation, \
|
||||||
refuse_with_confirmation, select_command_with_arrows
|
refuse_with_confirmation, select_command_with_arrows
|
||||||
from tests.functional.utils import functional
|
|
||||||
|
|
||||||
containers = (('thefuck/ubuntu-python3-fish',
|
containers = (('thefuck/ubuntu-python3-fish',
|
||||||
u'''FROM ubuntu:latest
|
u'''FROM ubuntu:latest
|
||||||
@ -29,25 +28,25 @@ def proc(request, spawnu):
|
|||||||
return proc
|
return proc
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
@pytest.mark.skip_without_docker
|
@pytest.mark.skip_without_docker
|
||||||
def test_with_confirmation(proc, TIMEOUT):
|
def test_with_confirmation(proc, TIMEOUT):
|
||||||
with_confirmation(proc, TIMEOUT)
|
with_confirmation(proc, TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
@pytest.mark.skip_without_docker
|
@pytest.mark.skip_without_docker
|
||||||
def test_select_command_with_arrows(proc, TIMEOUT):
|
def test_select_command_with_arrows(proc, TIMEOUT):
|
||||||
select_command_with_arrows(proc, TIMEOUT)
|
select_command_with_arrows(proc, TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
@pytest.mark.skip_without_docker
|
@pytest.mark.skip_without_docker
|
||||||
def test_refuse_with_confirmation(proc, TIMEOUT):
|
def test_refuse_with_confirmation(proc, TIMEOUT):
|
||||||
refuse_with_confirmation(proc, TIMEOUT)
|
refuse_with_confirmation(proc, TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
@pytest.mark.skip_without_docker
|
@pytest.mark.skip_without_docker
|
||||||
def test_without_confirmation(proc, TIMEOUT):
|
def test_without_confirmation(proc, TIMEOUT):
|
||||||
without_confirmation(proc, TIMEOUT)
|
without_confirmation(proc, TIMEOUT)
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from thefuck.main import _get_current_version
|
from thefuck.main import _get_current_version
|
||||||
from tests.functional.utils import functional
|
|
||||||
|
|
||||||
|
|
||||||
envs = ((u'bash', 'thefuck/ubuntu-bash', u'''
|
envs = ((u'bash', 'thefuck/ubuntu-bash', u'''
|
||||||
FROM ubuntu:latest
|
FROM ubuntu:latest
|
||||||
@ -13,7 +11,7 @@ RUN dnf install -yy python-devel sudo wget gcc
|
|||||||
'''))
|
'''))
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
@pytest.mark.skip_without_docker
|
@pytest.mark.skip_without_docker
|
||||||
@pytest.mark.parametrize('shell, tag, dockerfile', envs)
|
@pytest.mark.parametrize('shell, tag, dockerfile', envs)
|
||||||
def test_installation(spawnu, shell, TIMEOUT, tag, dockerfile):
|
def test_installation(spawnu, shell, TIMEOUT, tag, dockerfile):
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import pytest
|
import pytest
|
||||||
import time
|
import time
|
||||||
from tests.functional.utils import functional
|
|
||||||
|
|
||||||
dockerfile = u'''
|
dockerfile = u'''
|
||||||
FROM ubuntu:latest
|
FROM ubuntu:latest
|
||||||
@ -40,7 +39,7 @@ def plot(proc, TIMEOUT):
|
|||||||
assert proc.expect([TIMEOUT, u'test'])
|
assert proc.expect([TIMEOUT, u'test'])
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
@pytest.mark.skip_without_docker
|
@pytest.mark.skip_without_docker
|
||||||
@pytest.mark.benchmark(min_rounds=10)
|
@pytest.mark.benchmark(min_rounds=10)
|
||||||
def test_performance(spawnu, TIMEOUT, benchmark):
|
def test_performance(spawnu, TIMEOUT, benchmark):
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from tests.functional.utils import functional
|
|
||||||
from tests.functional.plots import with_confirmation, without_confirmation, \
|
from tests.functional.plots import with_confirmation, without_confirmation, \
|
||||||
refuse_with_confirmation, select_command_with_arrows
|
refuse_with_confirmation, select_command_with_arrows
|
||||||
|
|
||||||
@ -30,22 +29,22 @@ def proc(request, spawnu, run_without_docker):
|
|||||||
return proc
|
return proc
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
def test_with_confirmation(proc, TIMEOUT):
|
def test_with_confirmation(proc, TIMEOUT):
|
||||||
with_confirmation(proc, TIMEOUT)
|
with_confirmation(proc, TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
def test_select_command_with_arrows(proc, TIMEOUT):
|
def test_select_command_with_arrows(proc, TIMEOUT):
|
||||||
select_command_with_arrows(proc, TIMEOUT)
|
select_command_with_arrows(proc, TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
def test_refuse_with_confirmation(proc, TIMEOUT):
|
def test_refuse_with_confirmation(proc, TIMEOUT):
|
||||||
refuse_with_confirmation(proc, TIMEOUT)
|
refuse_with_confirmation(proc, TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
def test_without_confirmation(proc, TIMEOUT):
|
def test_without_confirmation(proc, TIMEOUT):
|
||||||
without_confirmation(proc, TIMEOUT)
|
without_confirmation(proc, TIMEOUT)
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import pytest
|
import pytest
|
||||||
from tests.functional.utils import functional
|
|
||||||
from tests.functional.plots import with_confirmation, without_confirmation, \
|
from tests.functional.plots import with_confirmation, without_confirmation, \
|
||||||
refuse_with_confirmation, history_changed, history_not_changed, select_command_with_arrows
|
refuse_with_confirmation, history_changed, history_not_changed, select_command_with_arrows
|
||||||
|
|
||||||
@ -34,25 +33,25 @@ def proc(request, spawnu, run_without_docker):
|
|||||||
return proc
|
return proc
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
def test_with_confirmation(proc, TIMEOUT):
|
def test_with_confirmation(proc, TIMEOUT):
|
||||||
with_confirmation(proc, TIMEOUT)
|
with_confirmation(proc, TIMEOUT)
|
||||||
history_changed(proc, TIMEOUT, u'echo test')
|
history_changed(proc, TIMEOUT, u'echo test')
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
def test_select_command_with_arrows(proc, TIMEOUT):
|
def test_select_command_with_arrows(proc, TIMEOUT):
|
||||||
select_command_with_arrows(proc, TIMEOUT)
|
select_command_with_arrows(proc, TIMEOUT)
|
||||||
history_changed(proc, TIMEOUT, u'git push')
|
history_changed(proc, TIMEOUT, u'git push')
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
def test_refuse_with_confirmation(proc, TIMEOUT):
|
def test_refuse_with_confirmation(proc, TIMEOUT):
|
||||||
refuse_with_confirmation(proc, TIMEOUT)
|
refuse_with_confirmation(proc, TIMEOUT)
|
||||||
history_not_changed(proc, TIMEOUT)
|
history_not_changed(proc, TIMEOUT)
|
||||||
|
|
||||||
|
|
||||||
@functional
|
@pytest.mark.functional
|
||||||
def test_without_confirmation(proc, TIMEOUT):
|
def test_without_confirmation(proc, TIMEOUT):
|
||||||
without_confirmation(proc, TIMEOUT)
|
without_confirmation(proc, TIMEOUT)
|
||||||
history_changed(proc, TIMEOUT, u'echo test')
|
history_changed(proc, TIMEOUT, u'echo test')
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
import pytest
|
|
||||||
import os
|
|
||||||
|
|
||||||
enabled = os.environ.get('FUNCTIONAL')
|
|
||||||
|
|
||||||
functional = pytest.mark.skipif(
|
|
||||||
not enabled,
|
|
||||||
reason='Functional tests are disabled by default.')
|
|
Loading…
x
Reference in New Issue
Block a user