Skip to content

Commit f1735cc

Browse files
authored
Merge pull request #110 from pusher/travis-test-newer-python-versions
Test versions 3.5 and 3.6 with travis
2 parents 88cf247 + f4fab06 commit f1735cc

File tree

3 files changed

+10
-22
lines changed

3 files changed

+10
-22
lines changed

.travis.yml

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
---
22
language: python
33
python:
4-
- "2.6"
54
- "2.7"
6-
- "3.3"
75
- "3.4"
6+
- "3.5"
7+
- "3.6"
88
before_install:
99
- pip install --upgrade setuptools
1010
install:
1111
- "python setup.py develop"
12-
- if [[ $TRAVIS_PYTHON_VERSION == '3.3' ]]; then pip install aiohttp==0.17.4; fi
13-
- if [[ $TRAVIS_PYTHON_VERSION == '3.4' ]]; then pip install aiohttp; fi
12+
- "if [[ $TRAVIS_PYTHON_VERSION == 3* ]]; then pip install aiohttp; fi"
1413
- "pip install tornado"
1514
- "pip install urlfetch"
16-
- if [[ $TRAVIS_PYTHON_VERSION == '2.6' ]]; then pip install unittest2; fi
1715
script: "python setup.py test"

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ In order to use this library, you need to have a free account on <http://pusher.
1010

1111
## Features
1212

13-
* Python 2.6, 2.7 and 3.3 support
13+
* Python 2.7, 3.4, 3.5 and 3.6 support
1414
* Adapters for various http libraries like requests, urlfetch, aiohttp and tornado.
1515
* WebHook validation
1616
* Signature generation for socket subscriptions

pusher_tests/test_request.py

+6-16
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import unittest
66
import re
7+
import sys
78

89
from pusher import Pusher
910
from pusher.http import Request
@@ -50,27 +51,16 @@ def test_post_signature_generation(self):
5051

5152
json_dumps_mock.assert_called_once_with({u"foo": u"bar"})
5253

53-
# Copied wholesale from https://github.com/python/cpython/blob/2d305e1c46abfcd609bf8b2dff8d2065e6af8ab2/Lib/unittest/case.py#L1279-L1289
54-
# This can be removed when we no longer support Python 2.6
55-
def assertRegexpMatches(self, text, expected_regex, msg=None):
56-
"""Fail the test unless the text matches the regular expression."""
57-
if isinstance(expected_regex, (str, bytes)):
58-
assert expected_regex, "expected_regex must not be empty."
59-
expected_regex = re.compile(expected_regex)
60-
if not expected_regex.search(text):
61-
standardMsg = "Regex didn't match: %r not found in %r" % (
62-
expected_regex.pattern, text)
63-
# _formatMessage ensures the longMessage option is respected
64-
msg = self._formatMessage(msg, standardMsg)
65-
raise self.failureException(msg)
66-
6754
def test_x_pusher_library_header(self):
6855
conf = Pusher.from_url(u'http://key:secret@somehost/apps/4')
6956
req = Request(conf._pusher_client, u'GET', u'/some/obscure/api', {u'foo': u'bar'})
7057
self.assertTrue('X-Pusher-Library' in req.headers)
7158
pusherLib = req.headers['X-Pusher-Library']
72-
self.assertRegexpMatches(pusherLib, r'^pusher-http-python \d+(\.\d+)+(rc\d+)?$')
73-
59+
regex = r'^pusher-http-python \d+(\.\d+)+(rc\d+)?$'
60+
if sys.version_info < (3,):
61+
self.assertRegexpMatches(pusherLib, regex)
62+
else:
63+
self.assertRegex(pusherLib, regex)
7464

7565
if __name__ == '__main__':
7666
unittest.main()

0 commit comments

Comments
 (0)