Skip to content

Commit fc0a44a

Browse files
Merge pull request softlayer#867 from allmightyspiff/windows-friendly
making the testing more windows friendly
2 parents 05b95c7 + 1b3d166 commit fc0a44a

5 files changed

Lines changed: 21 additions & 4 deletions

File tree

tests/CLI/helper_tests.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
"""
88
import json
99
import os
10+
import sys
1011
import tempfile
1112

13+
1214
import click
1315
import mock
1416
import six
@@ -369,7 +371,8 @@ def test_unknown(self):
369371
self.assertEqual({}, t)
370372

371373
def test_sequentialoutput(self):
372-
t = formatting.SequentialOutput()
374+
# specifying the separator prevents windows from using \n\r
375+
t = formatting.SequentialOutput(separator="\n")
373376
self.assertTrue(hasattr(t, 'append'))
374377
t.append('This is a test')
375378
t.append('')
@@ -446,7 +449,11 @@ def test_template_options(self):
446449

447450

448451
class TestExportToTemplate(testing.TestCase):
452+
449453
def test_export_to_template(self):
454+
if(sys.platform.startswith("win")):
455+
self.skipTest("Test doesn't work in Windows")
456+
# Tempfile creation is wonky on windows
450457
with tempfile.NamedTemporaryFile() as tmp:
451458

452459
template.export_to_template(tmp.name, {

tests/CLI/modules/config_tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
:license: MIT, see LICENSE for more details.
66
"""
77
import json
8+
import sys
89
import tempfile
910

1011
import mock
@@ -54,6 +55,8 @@ def set_up(self):
5455
@mock.patch('SoftLayer.CLI.environment.Environment.getpass')
5556
@mock.patch('SoftLayer.CLI.environment.Environment.input')
5657
def test_setup(self, mocked_input, getpass, confirm_mock):
58+
if(sys.platform.startswith("win")):
59+
self.skipTest("Test doesn't work in Windows")
5760
with tempfile.NamedTemporaryFile() as config_file:
5861
confirm_mock.return_value = True
5962
getpass.return_value = 'A' * 64

tests/CLI/modules/server_tests.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"""
1010

1111
import mock
12+
import sys
1213

1314
from SoftLayer.CLI import exceptions
1415
from SoftLayer import testing
@@ -310,6 +311,8 @@ def test_create_server_missing_required(self):
310311

311312
@mock.patch('SoftLayer.CLI.template.export_to_template')
312313
def test_create_server_with_export(self, export_mock):
314+
if(sys.platform.startswith("win")):
315+
self.skipTest("Test doesn't work in Windows")
313316
result = self.run_command(['--really', 'server', 'create',
314317
'--size=S1270_8GB_2X1TBSATA_NORAID',
315318
'--hostname=test',
@@ -382,10 +385,11 @@ def test_edit_server_failed(self, edit_mock):
382385
hostname='hardware-test1')
383386

384387
def test_edit_server_userfile(self):
388+
if(sys.platform.startswith("win")):
389+
self.skipTest("Test doesn't work in Windows")
385390
with tempfile.NamedTemporaryFile() as userfile:
386391
userfile.write(b"some data")
387392
userfile.flush()
388-
389393
result = self.run_command(['server', 'edit', '1000',
390394
'--userfile=%s' % userfile.name])
391395

tests/CLI/modules/sshkey_tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"""
77
import json
88
import os.path
9+
import sys
910
import tempfile
1011

1112
import mock
@@ -102,6 +103,8 @@ def test_print_key(self):
102103
{'id': 1234, 'label': 'label', 'notes': 'notes'})
103104

104105
def test_print_key_file(self):
106+
if(sys.platform.startswith("win")):
107+
self.skipTest("Test doesn't work in Windows")
105108
with tempfile.NamedTemporaryFile() as sshkey_file:
106109
service = self.client['Security_Ssh_Key']
107110
mock_key = service.getObject()['key']

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ deps = -r{toxinidir}/tools/test-requirements.txt
99
commands = py.test {posargs:tests}
1010

1111
[testenv:coverage]
12-
basepython = python2.7
12+
1313
commands = py.test {posargs:tests} \
1414
--cov=SoftLayer \
1515
--cov-fail-under=77 \
1616
--cov-report=html \
1717
--cov-report=term-missing
1818

1919
[testenv:analysis]
20-
basepython = python2.7
20+
2121
deps =
2222
-r{toxinidir}/tools/test-requirements.txt
2323
hacking

0 commit comments

Comments
 (0)