Yet another unittest extension for python.
Project description
Yet another unittest extension for python.
Live Server Test Case
The LiveServerTestCase extension does basically the same as unittest.TestCase but also launches a live http server in a separate thread.
A comma-separated list of ports or a range of ports can be specified in the hope the live server can find one that is free to use for the WSGI server. The range may be of the form: ‘8000-8010,8080,9020-9300’ and will be read from the ‘LIVE_TEST_SERVER_ADDRESS’ environment variable.
The function create_app() is used to return the handler used by the WSGI server.
Example
import unisquid
import urllib
import wsgiref
class TestLiveServer(unisquid.LiveServerTestCase):
def create_app(self):
return wsgiref.simple_server.demo_app
def test_server_process_listening(self):
response = urllib.urlopen(self.live_server_url)
self.assertTrue(b'Hello world!' in response.read())
self.assertEqual(response.code, 200)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
unisquid-1.0.1.tar.gz
(5.2 kB
view hashes)