Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion tests/CLI/helper_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
"""
import json
import os
import sys
import tempfile


import click
import mock
import six
Expand Down Expand Up @@ -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('')
Expand Down Expand Up @@ -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, {
Expand Down
3 changes: 3 additions & 0 deletions tests/CLI/modules/config_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:license: MIT, see LICENSE for more details.
"""
import json
import sys
import tempfile

import mock
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion tests/CLI/modules/server_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""

import mock
import sys

from SoftLayer.CLI import exceptions
from SoftLayer import testing
Expand Down Expand Up @@ -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',
Expand Down Expand Up @@ -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])

Expand Down
3 changes: 3 additions & 0 deletions tests/CLI/modules/sshkey_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""
import json
import os.path
import sys
import tempfile

import mock
Expand Down Expand Up @@ -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']
Expand Down
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ 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 \
--cov-report=html \
--cov-report=term-missing

[testenv:analysis]
basepython = python2.7

deps =
-r{toxinidir}/tools/test-requirements.txt
hacking
Expand Down