Skip to content
Myr

test_requests_async.py

This file

Path

tests/test_requests_async.py

67 lines · 1.4 KiB · Python

Last changed by

Merge pull request #565 from slingamn/cookiejarKenneth Reitzbefore adoption45be14e

History of this file

Take it

move tests overKenneth Reitzbefore adoption0b9a2a1

lines 1–10why, one step back
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-34# Path hack.5import sys, os6sys.path.insert(0, os.path.abspath('..'))78import sys9import unittest10

Merge branch 'develop' of github.com:kennethreitz/requests into developKenneth Reitzbefore adoption4c1852f

lines 11–13why, one step back
11import select
12has_poll = hasattr(select, "poll")13

move tests overKenneth Reitzbefore adoption0b9a2a1

lines 14–61why, one step back
14from requests import async
1516sys.path.append('.')17from test_requests import httpbin, RequestsTestSuite, SERVICES181920class RequestsTestSuiteUsingAsyncApi(RequestsTestSuite):21 """Requests async test cases."""2223 def patched(f):24 """Automatically send request after creation."""2526 def wrapped(*args, **kwargs):2728 request = f(*args, **kwargs)29 return async.map([request])[0]3031 return wrapped3233 # Patched requests.api functions.34 global request35 request = patched(async.request)3637 global delete, get, head, options, patch, post, put38 delete = patched(async.delete)39 get = patched(async.get)40 head = patched(async.head)41 options = patched(async.options)42 patch = patched(async.patch)43 post = patched(async.post)44 put = patched(async.put)454647 def test_entry_points(self):4849 async.request5051 async.delete52 async.get53 async.head54 async.options55 async.patch56 async.post57 async.put5859 async.map60 async.send61

Merge branch 'develop' of github.com:kennethreitz/requests into developKenneth Reitzbefore adoption4c1852f

lines 62–64why, one step back
62 def test_select_poll(self):
63 """Test to make sure we don't overwrite the poll"""64 self.assertEqual(hasattr(select, "poll"), has_poll)

move tests overKenneth Reitzbefore adoption0b9a2a1

lines 65–67why, one step back
65
66if __name__ == '__main__':67 unittest.main()