From e2f66cb26b75adbb49078de5df8e8a9dbed86ad9 Mon Sep 17 00:00:00 2001 From: nvbn Date: Mon, 27 Jun 2016 23:18:38 +0300 Subject: [PATCH 1/8] #N/A: Enable docker service --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 1c3e0664..2e3a6375 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,6 +16,8 @@ addons: - tcsh - pandoc - git +services: + - docker install: - pip install -U pip - pip install -U coveralls @@ -24,5 +26,5 @@ install: - rm -rf build script: - export COVERAGE_PYTHON_VERSION=python-${TRAVIS_PYTHON_VERSION:0:1} - - coverage run --source=thefuck,tests -m py.test -v --capture=sys + - coverage run --source=thefuck,tests -m py.test -v --capture=sys --enable-functional after_success: coveralls From 2bf21d9f0e6963c6a0ea39de4679bb4842616c16 Mon Sep 17 00:00:00 2001 From: nvbn Date: Mon, 27 Jun 2016 23:48:06 +0300 Subject: [PATCH 2/8] #524: Wait for prompt in zsh tests --- tests/functional/test_zsh.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tests/functional/test_zsh.py b/tests/functional/test_zsh.py index 68457bdf..9afe31c1 100644 --- a/tests/functional/test_zsh.py +++ b/tests/functional/test_zsh.py @@ -34,10 +34,15 @@ def proc(request, spawnu, run_without_docker): return proc +def wait_prompt(proc, TIMEOUT): + assert proc.expect([TIMEOUT, u'#']) + + @pytest.mark.functional -@pytest.mark.skip_without_docker +@pytest.mark.once_without_docker def test_with_confirmation(proc, TIMEOUT): with_confirmation(proc, TIMEOUT) + wait_prompt(proc, TIMEOUT) history_changed(proc, TIMEOUT, u'echo test') @@ -45,13 +50,15 @@ def test_with_confirmation(proc, TIMEOUT): @pytest.mark.once_without_docker def test_select_command_with_arrows(proc, TIMEOUT): select_command_with_arrows(proc, TIMEOUT) + wait_prompt(proc, TIMEOUT) history_changed(proc, TIMEOUT, u'git help') @pytest.mark.functional -@pytest.mark.skip_without_docker +@pytest.mark.once_without_docker def test_refuse_with_confirmation(proc, TIMEOUT): refuse_with_confirmation(proc, TIMEOUT) + wait_prompt(proc, TIMEOUT) history_not_changed(proc, TIMEOUT) @@ -59,6 +66,7 @@ def test_refuse_with_confirmation(proc, TIMEOUT): @pytest.mark.once_without_docker def test_without_confirmation(proc, TIMEOUT): without_confirmation(proc, TIMEOUT) + wait_prompt(proc, TIMEOUT) history_changed(proc, TIMEOUT, u'echo test') From 8bea63eb23f5a69dc99a95c937c7333b42399b22 Mon Sep 17 00:00:00 2001 From: nvbn Date: Mon, 27 Jun 2016 23:48:26 +0300 Subject: [PATCH 3/8] #524: Remove unned dependencies from `.travis.yml` --- .travis.yml | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2e3a6375..88e725ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,17 +5,6 @@ python: - "3.4" - "3.3" - "2.7" -addons: - apt: - sources: - - fish-shell/release-2 - packages: - - bash - - zsh - - fish - - tcsh - - pandoc - - git services: - docker install: @@ -27,4 +16,5 @@ install: script: - export COVERAGE_PYTHON_VERSION=python-${TRAVIS_PYTHON_VERSION:0:1} - coverage run --source=thefuck,tests -m py.test -v --capture=sys --enable-functional -after_success: coveralls +after_success: + - coveralls From 917c6ac887533059c776db1f015462869fa6e6dd Mon Sep 17 00:00:00 2001 From: nvbn Date: Tue, 28 Jun 2016 00:00:49 +0300 Subject: [PATCH 4/8] #524: Fix tcsh encoding --- tests/functional/test_tcsh.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/functional/test_tcsh.py b/tests/functional/test_tcsh.py index 5632370a..c5cc5a66 100644 --- a/tests/functional/test_tcsh.py +++ b/tests/functional/test_tcsh.py @@ -25,6 +25,7 @@ def proc(request, spawnu, run_without_docker): if not run_without_docker: proc.sendline(u'pip install /src') proc.sendline(u'tcsh') + proc.sendline(u'setenv PYTHONIOENCODING utf8') proc.sendline(u'eval `thefuck --alias`') return proc From 77ea630d84fb03d9bdd3c7721f8bca9e02e23d47 Mon Sep 17 00:00:00 2001 From: nvbn Date: Tue, 28 Jun 2016 00:11:56 +0300 Subject: [PATCH 5/8] #524: Remove `skip_without_docker` hacks --- tests/functional/test_fish.py | 8 ++++---- tests/functional/test_performance.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/functional/test_fish.py b/tests/functional/test_fish.py index eb02f053..ce7e01e6 100644 --- a/tests/functional/test_fish.py +++ b/tests/functional/test_fish.py @@ -29,25 +29,25 @@ def proc(request, spawnu): @pytest.mark.functional -@pytest.mark.skip_without_docker +@pytest.mark.once_without_docker def test_with_confirmation(proc, TIMEOUT): with_confirmation(proc, TIMEOUT) @pytest.mark.functional -@pytest.mark.skip_without_docker +@pytest.mark.once_without_docker def test_select_command_with_arrows(proc, TIMEOUT): select_command_with_arrows(proc, TIMEOUT) @pytest.mark.functional -@pytest.mark.skip_without_docker +@pytest.mark.once_without_docker def test_refuse_with_confirmation(proc, TIMEOUT): refuse_with_confirmation(proc, TIMEOUT) @pytest.mark.functional -@pytest.mark.skip_without_docker +@pytest.mark.once_without_docker def test_without_confirmation(proc, TIMEOUT): without_confirmation(proc, TIMEOUT) diff --git a/tests/functional/test_performance.py b/tests/functional/test_performance.py index c9b69357..f0917ecc 100644 --- a/tests/functional/test_performance.py +++ b/tests/functional/test_performance.py @@ -40,7 +40,7 @@ def plot(proc, TIMEOUT): @pytest.mark.functional -@pytest.mark.skip_without_docker +@pytest.mark.once_without_docker @pytest.mark.benchmark(min_rounds=10) def test_performance(spawnu, TIMEOUT, benchmark): proc = spawnu(u'thefuck/ubuntu-python3-bash-performance', From 9b6cd0cd7b86f63b365d2c1968fd19495b707758 Mon Sep 17 00:00:00 2001 From: nvbn Date: Tue, 28 Jun 2016 00:22:04 +0300 Subject: [PATCH 6/8] #524: Exit with `1` if no fixed command selected --- thefuck/main.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/thefuck/main.py b/thefuck/main.py index 506a1a06..7a9c371e 100644 --- a/thefuck/main.py +++ b/thefuck/main.py @@ -33,6 +33,8 @@ def fix_command(): if selected_command: selected_command.run(command) + else: + sys.exit(1) def print_alias(entry_point=True): From 1b7c8b5498e3d422ebfeb1a2fdd7a97030713e5d Mon Sep 17 00:00:00 2001 From: nvbn Date: Tue, 28 Jun 2016 00:22:25 +0300 Subject: [PATCH 7/8] #524: Don't wait for prompt in zsh --- tests/functional/test_zsh.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/functional/test_zsh.py b/tests/functional/test_zsh.py index 9afe31c1..c0df1f09 100644 --- a/tests/functional/test_zsh.py +++ b/tests/functional/test_zsh.py @@ -34,15 +34,10 @@ def proc(request, spawnu, run_without_docker): return proc -def wait_prompt(proc, TIMEOUT): - assert proc.expect([TIMEOUT, u'#']) - - @pytest.mark.functional @pytest.mark.once_without_docker def test_with_confirmation(proc, TIMEOUT): with_confirmation(proc, TIMEOUT) - wait_prompt(proc, TIMEOUT) history_changed(proc, TIMEOUT, u'echo test') @@ -50,7 +45,6 @@ def test_with_confirmation(proc, TIMEOUT): @pytest.mark.once_without_docker def test_select_command_with_arrows(proc, TIMEOUT): select_command_with_arrows(proc, TIMEOUT) - wait_prompt(proc, TIMEOUT) history_changed(proc, TIMEOUT, u'git help') @@ -58,7 +52,6 @@ def test_select_command_with_arrows(proc, TIMEOUT): @pytest.mark.once_without_docker def test_refuse_with_confirmation(proc, TIMEOUT): refuse_with_confirmation(proc, TIMEOUT) - wait_prompt(proc, TIMEOUT) history_not_changed(proc, TIMEOUT) @@ -66,7 +59,6 @@ def test_refuse_with_confirmation(proc, TIMEOUT): @pytest.mark.once_without_docker def test_without_confirmation(proc, TIMEOUT): without_confirmation(proc, TIMEOUT) - wait_prompt(proc, TIMEOUT) history_changed(proc, TIMEOUT, u'echo test') From 729508e581393075b0f5f10c6e1e1e6f95af89e5 Mon Sep 17 00:00:00 2001 From: nvbn Date: Tue, 28 Jun 2016 00:38:38 +0300 Subject: [PATCH 8/8] #524: Add commandnotfound to travis config --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 88e725ad..c4b71bbd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,11 @@ python: - "2.7" services: - docker +addons: + apt: + packages: + - python-commandnotfound + - python3-commandnotfound install: - pip install -U pip - pip install -U coveralls