Skip to main content

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


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 details)

Uploaded Source

File details

Details for the file unisquid-1.0.1.tar.gz.

File metadata

  • Download URL: unisquid-1.0.1.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for unisquid-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0daa12eff08821eb68c73f696e03c28e49e6c292af47d26f7a0a8c1e1b6a726d
MD5 54bef3b3b2d14ae8a3f3a05e3a285184
BLAKE2b-256 a33549c6675dfa9c9b2f9f6baba845f8b5e8e8beb3843ae319ae7bebdb66737c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page