From 69db5c70e6ba9cc5af2910f08a6e2c4421397ead Mon Sep 17 00:00:00 2001 From: Pablo Santiago Blum de Aguiar Date: Tue, 29 Mar 2016 23:10:59 -0300 Subject: [PATCH 1/4] #486: Fix path joining on Windows --- tests/test_types.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_types.py b/tests/test_types.py index dcb4e87..2909412 100644 --- a/tests/test_types.py +++ b/tests/test_types.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- +import os from subprocess import PIPE from mock import Mock from pathlib import Path @@ -39,9 +40,10 @@ class TestRule(object): enabled_by_default=True, priority=900, requires_output=True)) - assert Rule.from_path(Path('/rules/bash.py')) \ + rule_path = os.path.join(os.sep, 'rules', 'bash.py') + assert Rule.from_path(Path(rule_path)) \ == Rule('bash', match, get_new_command, priority=900) - load_source.assert_called_once_with('bash', '/rules/bash.py') + load_source.assert_called_once_with('bash', rule_path) @pytest.mark.parametrize('rules, exclude_rules, rule, is_enabled', [ (const.DEFAULT_RULES, [], Rule('git', enabled_by_default=True), True), From 047a1a6072905e650d8a8c6dee3078a14b9df759 Mon Sep 17 00:00:00 2001 From: Pablo Santiago Blum de Aguiar Date: Tue, 29 Mar 2016 23:34:08 -0300 Subject: [PATCH 2/4] #486: Use Path instead of PosixPath --- tests/test_corrector.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_corrector.py b/tests/test_corrector.py index ac95e54..164f61f 100644 --- a/tests/test_corrector.py +++ b/tests/test_corrector.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- import pytest -from pathlib import PosixPath +from pathlib import Path from thefuck import corrector, const from tests.utils import Rule, Command, CorrectedCommand from thefuck.corrector import get_corrected_commands, organize_commands @@ -30,7 +30,7 @@ class TestGetRules(object): (['git.py', 'bash.py'], ['git'], ['git'], [])]) def test_get_rules(self, glob, settings, paths, conf_rules, exclude_rules, loaded_rules): - glob([PosixPath(path) for path in paths]) + glob([Path(path) for path in paths]) settings.update(rules=conf_rules, priority={}, exclude_rules=exclude_rules) From 28153db4a835808d850f01f09f7bf5f4cb92394e Mon Sep 17 00:00:00 2001 From: Pablo Santiago Blum de Aguiar Date: Tue, 29 Mar 2016 23:34:29 -0300 Subject: [PATCH 3/4] #486: Ignore a test on Windows --- tests/rules/test_ssh_known_host.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/rules/test_ssh_known_host.py b/tests/rules/test_ssh_known_host.py index f2828a3..66b76e9 100644 --- a/tests/rules/test_ssh_known_host.py +++ b/tests/rules/test_ssh_known_host.py @@ -52,6 +52,7 @@ def test_match(ssh_error): assert not match(Command('ssh')) +@pytest.mark.skipif(os.name == 'nt', reason='Skip if testing on Windows') def test_side_effect(ssh_error): errormsg, path, reset, known_hosts = ssh_error command = Command('ssh user@host', stderr=errormsg) From 18b4f5df6a007a7cba108de1ced3779ef47f2ff0 Mon Sep 17 00:00:00 2001 From: Pablo Santiago Blum de Aguiar Date: Tue, 29 Mar 2016 23:35:19 -0300 Subject: [PATCH 4/4] #486: Run tests on AppVeyor --- appveyor.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..d7072f7 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,22 @@ +build: false + +environment: + matrix: + - PYTHON: "C:/Python27" + - PYTHON: "C:/Python33" + - PYTHON: "C:/Python34" + - PYTHON: "C:/Python35" + +init: + - "ECHO %PYTHON%" + - ps: "ls C:/Python*" + +install: + - ps: (new-object net.webclient).DownloadFile('https://bootstrap.pypa.io/get-pip.py', 'C:/get-pip.py') + - "%PYTHON%/python.exe C:/get-pip.py" + - "%PYTHON%/Scripts/pip.exe install -U setuptools" + - "%PYTHON%/python.exe setup.py develop" + - "%PYTHON%/Scripts/pip.exe install -U -r requirements.txt" + +test_script: + - "%PYTHON%/Scripts/py.test.exe -sv"