Some pyflakes fixes.
Before adoption: this commit came in with the history the project adopted, so no landing records it.
They were just bothering me far too much with vim+syntastic.
authored by Ian Cordasco · committed by Ian Cordasco · parent 2b33bc2 · Browse files · 2 files·+25 added−12 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+25 added−12 removed
- tests:+24 added−11 removed
- other:+1 added−1 removed
Provenance
- Commit
c71f48b- Tree
0a2271b- Author
Ian Cordasco <graffatcolmingov@gmail.com>- Committer
Ian Cordasco <graffatcolmingov@gmail.com>- Parent
2b33bc2
2 files changed+25 added−12 removed
modified:tests/test_requests.py+24 added-11 removed
50 unmodified lines51 # c = envoy.connect('httpbin %s' % (PORT))52 # time.sleep(1)53 _httpbin = True54 55+56 class TestBaseMixin(object):57 58 def assertCookieHas(self, cookie, **kwargs):59 """Assert that a cookie has various specified properties."""60 for attr, expected_value in kwargs.items():61 cookie_attr = getattr(cookie, attr)61- message = 'Failed comparison for %s: %s != %s' % (attr, cookie_attr, expected_value)62+ message = 'Failed comparison for %s: %s != %s' % (attr,63+ cookie_attr, expected_value)64 self.assertEqual(cookie_attr, expected_value, message)65 66+67 class RequestsTestSuite(TestSetup, TestBaseMixin, unittest.TestCase):68 """Requests test cases."""69 70 def test_entry_points(self):52 unmodified lines123 124 def test_HTTP_200_OK_GET_WITH_MIXED_PARAMS(self):125 heads = {'User-agent': 'Mozilla/5.0'}126 124- r = get(httpbin('get') + '?test=true', params={'q': 'test'}, headers=heads)127+ r = get(httpbin('get') + '?test=true', params={'q': 'test'},128+ headers=heads)129 self.assertEqual(r.status_code, 200)130 131 # def test_unicode_headers(self):132 # # Simply calling requests with a unicode instance should simply work631 unmodified lines764 c = json.loads(r.text).get('cookies')765 self.assertEqual(c, _c)766 767 # Have the server set a cookie.764- r = get(httpbin('cookies', 'set', 'k', 'v'), allow_redirects=True, session=s)768+ r = get(httpbin('cookies', 'set', 'k', 'v'), allow_redirects=True,769+ session=s)770 c = json.loads(r.text).get('cookies')771 772 assert 'k' in c773 56 unmodified lines830 self.assertCookieHas(cookie, name='a-cookie', value='cookie-value')831 832 def test_unpickled_session_requests(self):833 s = requests.session()829- r = get(httpbin('cookies', 'set', 'k', 'v'), allow_redirects=True, session=s)834+ r = get(httpbin('cookies', 'set', 'k', 'v'), allow_redirects=True,835+ session=s)836 c = json.loads(r.text).get('cookies')837 assert 'k' in c838 839 ds = pickle.loads(pickle.dumps(s))120 unmodified lines960 s = requests.session()961 s.config['danger_mode'] = True962 s.get(httpbin('redirect', '4'))963 958-964 def test_empty_response(self):965 r = requests.get(httpbin('status', '404'))966 r.text967 968 def test_max_redirects(self):964- """Test the max_redirects config variable, normally and under safe_mode."""969+ """Test the max_redirects config variable, normally and under970+ safe_mode.971+ """972 def unsafe_callable():966- requests.get(httpbin('redirect', '3'), config=dict(max_redirects=2))967- self.assertRaises(requests.exceptions.TooManyRedirects, unsafe_callable)973+ requests.get(httpbin('redirect', '3'),974+ config=dict(max_redirects=2))975+ self.assertRaises(requests.exceptions.TooManyRedirects,976+ unsafe_callable)977 978 # add safe mode970- response = requests.get(httpbin('redirect', '3'), config=dict(safe_mode=True, max_redirects=2))979+ response = requests.get(httpbin('redirect', '3'),980+ config=dict(safe_mode=True, max_redirects=2))981 self.assertTrue(response.content is None)972- self.assertTrue(isinstance(response.error, requests.exceptions.TooManyRedirects))982+ self.assertTrue(isinstance(response.error,983+ requests.exceptions.TooManyRedirects))984 985 def test_connection_keepalive_and_close(self):975- """Test that we send 'Connection: close' when keep_alive is disabled."""986+ """Test that we send 'Connection: close' when keep_alive is987+ disabled.988+ """989 # keep-alive should be on by default990 r1 = requests.get(httpbin('get'))991 # XXX due to proxying issues, test the header sent back by httpbin, rather than992 # the header reported in its message body. See kennethreitz/httpbin#4631 unmodified linesmodified:Makefile+1 added-1 removed
35 unmodified lines36 cipyflakes:37 ${PYFLAKES_IF_AVAILABLE} ${PYFLAKES_WHITELIST}38 39 citests:40- nosetests ${CI_TESTS} --with-xunit --xunit-file=junit-report.xml40+ nosetests ${CI_TESTS} -v --with-xunit --xunit-file=junit-report.xml41 42 ci: citests cipyflakes43 44 travis: citests36 unmodified lines