diff --git a/tests/CLI/helper_tests.py b/tests/CLI/helper_tests.py index d5aa291d4..e6bbfe52d 100644 --- a/tests/CLI/helper_tests.py +++ b/tests/CLI/helper_tests.py @@ -7,8 +7,10 @@ """ import json import os +import sys import tempfile + import click import mock import six @@ -369,7 +371,8 @@ def test_unknown(self): self.assertEqual({}, t) def test_sequentialoutput(self): - t = formatting.SequentialOutput() + # specifying the separator prevents windows from using \n\r + t = formatting.SequentialOutput(separator="\n") self.assertTrue(hasattr(t, 'append')) t.append('This is a test') t.append('') @@ -446,7 +449,11 @@ def test_template_options(self): class TestExportToTemplate(testing.TestCase): + def test_export_to_template(self): + if(sys.platform.startswith("win")): + self.skipTest("Test doesn't work in Windows") + # Tempfile creation is wonky on windows with tempfile.NamedTemporaryFile() as tmp: template.export_to_template(tmp.name, { diff --git a/tests/CLI/modules/config_tests.py b/tests/CLI/modules/config_tests.py index eebf4ea2b..5c21b1da8 100644 --- a/tests/CLI/modules/config_tests.py +++ b/tests/CLI/modules/config_tests.py @@ -5,6 +5,7 @@ :license: MIT, see LICENSE for more details. """ import json +import sys import tempfile import mock @@ -54,6 +55,8 @@ def set_up(self): @mock.patch('SoftLayer.CLI.environment.Environment.getpass') @mock.patch('SoftLayer.CLI.environment.Environment.input') def test_setup(self, mocked_input, getpass, confirm_mock): + if(sys.platform.startswith("win")): + self.skipTest("Test doesn't work in Windows") with tempfile.NamedTemporaryFile() as config_file: confirm_mock.return_value = True getpass.return_value = 'A' * 64 diff --git a/tests/CLI/modules/server_tests.py b/tests/CLI/modules/server_tests.py index b34571e70..aecda810c 100644 --- a/tests/CLI/modules/server_tests.py +++ b/tests/CLI/modules/server_tests.py @@ -9,6 +9,7 @@ """ import mock +import sys from SoftLayer.CLI import exceptions from SoftLayer import testing @@ -310,6 +311,8 @@ def test_create_server_missing_required(self): @mock.patch('SoftLayer.CLI.template.export_to_template') def test_create_server_with_export(self, export_mock): + if(sys.platform.startswith("win")): + self.skipTest("Test doesn't work in Windows") result = self.run_command(['--really', 'server', 'create', '--size=S1270_8GB_2X1TBSATA_NORAID', '--hostname=test', @@ -382,10 +385,11 @@ def test_edit_server_failed(self, edit_mock): hostname='hardware-test1') def test_edit_server_userfile(self): + if(sys.platform.startswith("win")): + self.skipTest("Test doesn't work in Windows") with tempfile.NamedTemporaryFile() as userfile: userfile.write(b"some data") userfile.flush() - result = self.run_command(['server', 'edit', '1000', '--userfile=%s' % userfile.name]) diff --git a/tests/CLI/modules/sshkey_tests.py b/tests/CLI/modules/sshkey_tests.py index fc1ded0e6..e0e79b4cd 100644 --- a/tests/CLI/modules/sshkey_tests.py +++ b/tests/CLI/modules/sshkey_tests.py @@ -6,6 +6,7 @@ """ import json import os.path +import sys import tempfile import mock @@ -102,6 +103,8 @@ def test_print_key(self): {'id': 1234, 'label': 'label', 'notes': 'notes'}) def test_print_key_file(self): + if(sys.platform.startswith("win")): + self.skipTest("Test doesn't work in Windows") with tempfile.NamedTemporaryFile() as sshkey_file: service = self.client['Security_Ssh_Key'] mock_key = service.getObject()['key'] diff --git a/tox.ini b/tox.ini index 62f1fe67d..b2a8996e1 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,7 @@ deps = -r{toxinidir}/tools/test-requirements.txt commands = py.test {posargs:tests} [testenv:coverage] -basepython = python2.7 + commands = py.test {posargs:tests} \ --cov=SoftLayer \ --cov-fail-under=77 \ @@ -17,7 +17,7 @@ commands = py.test {posargs:tests} \ --cov-report=term-missing [testenv:analysis] -basepython = python2.7 + deps = -r{toxinidir}/tools/test-requirements.txt hacking