Skip to content

Commit 650f09d

Browse files
Fred PhillipsFred Phillips
authored andcommitted
Set up continuous integration
- add Travis CI - add tox - move tests to own directory - migrate to pytest Signed-off-by: Fred Phillips <[email protected]>
1 parent e9a70dd commit 650f09d

File tree

5 files changed

+33
-12
lines changed

5 files changed

+33
-12
lines changed

.travis.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
language: python
2+
python:
3+
- "2.7"
4+
- "3.6"
5+
- "pypy"
6+
- "pypy3"
7+
install:
8+
- pip install tox-travis
9+
script:
10+
- tox

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
license='Apache 2.0',
1010
packages=["github_webhook"],
1111
install_requires=['flask', 'six'],
12-
tests_require=['mock', 'nose'],
12+
tests_require=['mock', 'pytest'],
1313

1414
classifiers=[
1515
'Development Status :: 4 - Beta',

tests/__init__.py

Whitespace-only changes.

github_webhook/test_webhook.py renamed to tests/test_webhook.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
from __future__ import print_function
44

5-
import unittest
65
try:
76
from unittest.mock import Mock
87
except ImportError:
@@ -11,18 +10,19 @@
1110
from github_webhook.webhook import Webhook
1211

1312

14-
class TestWebhook(unittest.TestCase):
13+
def test_constructor():
14+
# GIVEN
15+
app = Mock()
1516

16-
def test_constructor(self):
17-
# GIVEN
18-
app = Mock()
17+
# WHEN
18+
webhook = Webhook(app)
1919

20-
# WHEN
21-
webhook = Webhook(app)
22-
23-
# THEN
24-
app.add_url_rule.assert_called_once_with(
25-
'/postreceive', view_func=webhook._postreceive, methods=['POST'])
20+
# THEN
21+
app.add_url_rule.assert_called_once_with(
22+
endpoint='/postreceive',
23+
rule='/postreceive',
24+
view_func=webhook._postreceive,
25+
methods=['POST'])
2626

2727
# -----------------------------------------------------------------------------
2828
# Copyright 2015 Bloomberg Finance L.P.

tox.ini

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[tox]
2+
envlist = py27,py36,pypy,pypy3
3+
4+
[testenv]
5+
deps =
6+
pytest
7+
pytest-cov
8+
flask
9+
six
10+
py{27,py}: mock
11+
commands = pytest -vl --cov=github_webhook --cov-report term-missing

0 commit comments

Comments
 (0)