Skip to content

Commit 9556e4d

Browse files
authored
Merge pull request #11 from internap/pep8
Add PEP8 validation
2 parents e3282de + 935625a commit 9556e4d

File tree

8 files changed

+25
-9
lines changed

8 files changed

+25
-9
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
language: python
2+
sudo: false
23

34
python:
45
- "2.7"
@@ -8,7 +9,9 @@ install:
89
- pip install -r requirements.txt
910
- pip install -r test-requirements.txt
1011

11-
script: nosetests
12+
script:
13+
- nosetests
14+
- flake8
1215

1316
deploy:
1417
provider: pypi

setup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
#!/usr/bin/env python
16-
1715
from setuptools import setup
1816

1917
setup(

test-requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ nose>=1.2.1
22
mock>=1.0.1
33
pyhamcrest>=1.6
44
flexmock>=0.10.2
5+
flake8>=3.3.0

tests/test_api.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ def test_execute_method_returns_string(self):
6565
}
6666
))
6767

68-
self.router.invoke_method.assert_called_with(module=self.module2, method='remote_method', params=[], env={'variable1': 'value1'}, callback={})
68+
self.router.invoke_method.assert_called_with(module=self.module2, method='remote_method', params=[],
69+
env={'variable1': 'value1'}, callback={})
6970
assert_that(json.loads(output.data.decode(output.charset)), is_('simple string'))
7071
assert_that(output.status_code, is_(200))
7172

@@ -84,7 +85,8 @@ def test_execute_method_raise_an_exception(self):
8485
}
8586
))
8687

87-
self.router.invoke_method.assert_called_with(module=self.module2, method='remote_method', params=[], env={'variable1': 'value1'}, callback={})
88+
self.router.invoke_method.assert_called_with(module=self.module2, method='remote_method', params=[],
89+
env={'variable1': 'value1'}, callback={})
8890
assert_that(json.loads(output.data.decode(output.charset)), is_('Some Error'))
8991
assert_that(output.status_code, is_(500))
9092

@@ -103,7 +105,8 @@ def test_execute_method_returns_list(self):
103105
}
104106
))
105107

106-
self.router.invoke_method.assert_called_with(module=self.module2, method='remote_method', params=[], env={'variable1': 'value1'}, callback={})
108+
self.router.invoke_method.assert_called_with(module=self.module2, method='remote_method', params=[],
109+
env={'variable1': 'value1'}, callback={})
107110
assert_that(json.loads(output.data.decode(output.charset)), is_(['a', 'b', 'c']))
108111
assert_that(output.status_code, is_(200))
109112

@@ -131,4 +134,4 @@ def test_listing_unknown_module_returns_a_404(self):
131134

132135
class NoTrailingSlashApiTest(ApiTest):
133136
def generate_module_path(self, module_name):
134-
return '/{0}'.format(module_name)
137+
return '/{0}'.format(module_name)

tests/test_server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class TestModule(object):
2222
def hello(self):
2323
return "world"
2424

25+
2526
@mock.patch('ubersmith_remote_module_server.server.Flask')
2627
@mock.patch('ubersmith_remote_module_server.server.router.Router')
2728
@mock.patch('ubersmith_remote_module_server.server.api.Api')

tox.ini

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
[tox]
2-
envlist = py27,py34
2+
envlist = py27,py34,pep8
33

44
[testenv]
55
deps = -r{toxinidir}/test-requirements.txt
66
commands =
77
nosetests
88

9+
[testenv:pep8]
10+
basepython = python3
11+
commands = flake8
12+
13+
[flake8]
14+
exclude = .eggs,.tox
15+
show-source = True
16+
max-line-length = 120

ubersmith_remote_module_server/remote.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,5 @@ def invoke_global(self, func_name, args):
7272
function='_web_hook_invoke_global',
7373
module_params=[func_name, [args]])
7474

75+
7576
ubersmith = UbersmithRemoteProxy()

ubersmith_remote_module_server/server.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616

1717
from ubersmith_remote_module_server import api, router
1818

19+
1920
class Server(object):
2021
def __init__(self, modules):
2122
self.router = router.Router()
2223
self.app = Flask(__name__)
2324
self.api = api.Api(modules, self.app, self.router)
2425

2526
def run(self, *args, **kwargs):
26-
self.app.run(*args, **kwargs)
27+
self.app.run(*args, **kwargs)

0 commit comments

Comments
 (0)