Skip to content

Commit a140c2f

Browse files
committed
Adjustment so Tox works with Python3
The 2to3 tool runs against the code and dumps the updated code into the build directory. Because of this, 'tests' was added to packages in the setup.py file. This change moves tests under SoftLayer and removes it from the setup.py. This change also removes Python 2.4 and 2.5 from the tox file.
1 parent 2340ee3 commit a140c2f

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
import os
77

88

9+
NO_CREDS_TEXT = 'SL_USERNAME and SL_API_KEY environmental variables not set'
10+
HAS_CREDS = True
11+
for key in 'SL_USERNAME SL_API_KEY'.split():
12+
if key not in os.environ:
13+
HAS_CREDS = False
14+
break
15+
916
def get_creds():
1017
return {
1118
'username': os.environ['SL_USERNAME'],
@@ -22,7 +29,7 @@ def test_failed_auth(self):
2229
timeout=20)
2330
self.assertRaises(SoftLayer.API.SoftLayerError, client.getPortalLoginToken)
2431

25-
32+
@unittest.skipIf(not HAS_CREDS, NO_CREDS_TEXT)
2633
class AuthedUser(unittest.TestCase):
2734
def test_result_types(self):
2835
creds = get_creds()

setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
description="A library to contact SoftLayer's backend services",
1919
author='SoftLayer Technologies, Inc.',
2020
author_email='[email protected]',
21-
packages=[
22-
'SoftLayer', 'tests'
23-
],
21+
packages=['SoftLayer'],
2422
license='The BSD License',
2523
url='http://github.com/softlayer/softlayer-api-python-client',
2624
classifiers=[

tox.ini

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py24,py25,py26,py27,py32,pypy
2+
envlist = py26,py27,py33,pypy
33

44
[testenv]
55
commands = nosetests []
@@ -8,11 +8,10 @@ deps =
88
yanc
99
unittest2
1010

11-
[testenv:py32]
12-
11+
[testenv:py33]
1312
commands =
1413
{envpython} setup.py build
15-
nosetests -w build/lib/tests []
14+
nosetests -w build/lib []
1615
deps =
1716
nose
1817
yanc

0 commit comments

Comments
 (0)