Skip to content

Commit 099024d

Browse files
author
Elias Nygren
committed
Merge pull request #7 from UpCloudLtd/py26-py27-support
py2/3 support
2 parents 20205c2 + 2e29ec6 commit 099024d

25 files changed

+178
-22
lines changed

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ python setup.py install
1919

2020
**Supported versions** (offline tests pass with tox):
2121

22-
* python 3.2
23-
* python 3.3
22+
* python 2.6
23+
* python 2.7
24+
* <del>python 3.2</del> removed due to python2/3 support
25+
* python 3.3
2426
* python 3.4
2527
* python 3.5
2628
* pypi3 2.4.0
@@ -34,7 +36,7 @@ python setup.py install
3436
* Scale horizontally by creating / destroying servers
3537
* Scale vertically by changing the RAM, CPU, storage specs of any server
3638
* Manage firewall (on/off and individual rules)
37-
* since 0.2: full management of firewall rules
39+
* since 0.2: full management of firewall rules
3840

3941
**TODO:**
4042
* Cloning of storages
@@ -173,11 +175,11 @@ Tests located in `project_root/tests/` directory. Run with:
173175
py.test tests/
174176
```
175177

176-
To test against python3.2=< and pypy3-2.4.0, run:
178+
To test against all supported python versions, run:
177179

178180
```python
179181
tox
180-
```
182+
```
181183

182184
The project also supplies a small test suite to test against the live API at `test/live_test.py`. This suite is NOT run with `py.test` as it will permanently remove all resources related to an account. It should only be run with a throwaway dev-only account when preparing for a new release. It is not shipped with PyPI releases. See source code on how to run the live tests.
183185

requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
future==0.14.3
12
mock==1.0.1
23
py==1.4.26
34
pytest==2.6.4
45
requests==2.6.0
56
responses==0.3.0
67
six==1.9.0
8+
wheel==0.24.0

setup.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,13 @@
1515
download='https://github.com/UpCloudLtd/upcloud-python-api/tarball/v0.2.0',
1616
license='MIT',
1717
install_requires=[
18+
'future==0.14.3',
1819
'mock==1.0.1',
1920
'py==1.4.26',
2021
'pytest==2.6.4',
2122
'requests==2.6.0',
2223
'responses==0.3.0',
23-
'six==1.9.0'
24+
'six==1.9.0',
25+
'wheel==0.24.0'
2426
]
2527
)

test/conftest.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
from __future__ import unicode_literals
2+
from __future__ import print_function
3+
from __future__ import division
4+
from __future__ import absolute_import
5+
from builtins import open
6+
from future import standard_library
7+
standard_library.install_aliases()
8+
from builtins import object
19
import os
210
import pytest
311
import responses
@@ -10,7 +18,7 @@ def manager():
1018
return upcloud.CloudManager("testuser", "mock-api-password")
1119

1220

13-
class Mock():
21+
class Mock(object):
1422
base_url = 'https://api.upcloud.com/1.2'
1523

1624
@staticmethod

test/live_test.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
from __future__ import print_function
2+
from __future__ import unicode_literals
3+
from __future__ import division
4+
from __future__ import absolute_import
5+
from builtins import input
6+
from future import standard_library
7+
standard_library.install_aliases()
18
import sys
29
from time import sleep
310

test/test_cloud_manager.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
from __future__ import unicode_literals
2+
from __future__ import print_function
3+
from __future__ import division
4+
from __future__ import absolute_import
5+
from future import standard_library
6+
standard_library.install_aliases()
7+
from builtins import object
18
import responses
29
import json
310
from conftest import Mock
411

5-
class TestCloudManagerBasic():
12+
class TestCloudManagerBasic(object):
613
@responses.activate
714
def test_get_account(self, manager):
815
data = Mock.mock_get("account")

test/test_firewall.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
from __future__ import unicode_literals
2+
from __future__ import print_function
3+
from __future__ import division
4+
from __future__ import absolute_import
5+
from future import standard_library
6+
standard_library.install_aliases()
7+
from builtins import object
18
from upcloud import FirewallRule
29
import responses
310
import json
@@ -38,7 +45,7 @@ def check_fields(body):
3845

3946

4047

41-
class TestFirewall():
48+
class TestFirewall(object):
4249
@responses.activate
4350
def test_add_firewall_rule(self, manager):
4451
Mock.mock_get("server/00798b85-efdc-41ca-8021-f6ef457b8531")

test/test_ip_manager.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
from __future__ import unicode_literals
2+
from __future__ import print_function
3+
from __future__ import division
4+
from __future__ import absolute_import
5+
from future import standard_library
6+
standard_library.install_aliases()
7+
from builtins import object
18
import responses
29
import json
310
from conftest import Mock
411

5-
class TestIP():
12+
class TestIP(object):
613
@responses.activate
714
def test_get_ip(self, manager):
815
data = Mock.mock_get("ip_address/10.1.0.101")

test/test_server.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
from __future__ import unicode_literals
2+
from __future__ import print_function
3+
from __future__ import division
4+
from __future__ import absolute_import
5+
from builtins import str
6+
from future import standard_library
7+
standard_library.install_aliases()
8+
from builtins import object
19
import responses
210
import json
311
from conftest import Mock
412
import pytest
513

6-
class TestServer():
14+
class TestServer(object):
715
@responses.activate
816
def test_get_server(self, manager):
917
data = Mock.mock_get("server/00798b85-efdc-41ca-8021-f6ef457b8531")

test/test_server_creation.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
from __future__ import unicode_literals
2+
from __future__ import print_function
3+
from __future__ import division
4+
from __future__ import absolute_import
5+
from future import standard_library
6+
standard_library.install_aliases()
7+
from builtins import object
18
from conftest import Mock
29
from upcloud import ZONE
310
from upcloud import Server
@@ -6,7 +13,7 @@
613
import json
714
import pytest
815

9-
class TestCreateServer():
16+
class TestCreateServer(object):
1017

1118

1219
def test_storage_prepare_post_body(self, manager):

0 commit comments

Comments
 (0)