Skip to main content

Extends Nose with certain TestNG like features.

Project description

=========
Proboscis
=========

An extension for Nose that facilitates higher level testing.

Changes how test classes are discovered by forcing them to register via
decorators which contain useful metadata such as what groups they are in,
whether or not they have dependencies on other tests, and if they should be
ignored.

Proboscis sorts all registered tests into the desired run order then
constructs a test suite which it passes to Nose. It can also filter this list
so that it's possible to specify which groups of tests you wish to run without
passing in the exact test classes. At runtime, tests which depend on other
tests that have failed are automatically marked as skipped.

Much of this functionality was "inspired" by TestNG. If you're coming from
that framework, the main features Proboscis currently offers are dependent test
ordering and the ability to arrange tests into groups independent of the
structure of their modules or packages.

With Proboscis it's possible to write tests which depend on a web service
(or some other dependency you'd like to only initialize once) like this:

@test(groups=["service.tests"], depends_on_groups=["service.initialization"])
class WhenConnectingAsAdmin(unittest.TestCase):

def test_change_profile_image(self):
self.client = mymodule.ServiceClient(service_config)
self.assertEquals("default.jpg", self.client.get_profile_image())
self.client.set_profile_image("spam.jpg")
self.assertEquals("spam.jpg", self.client.get_profile_image())

Then write the code to start and cleanly shut down that web service in any other
module as a first class test itself:

@test(groups=["service.initialization"])
class StartWebServer(unittest.TestCase):

def test_start(self):
# Start up web server, then issues a connect.
mymodule.start_web_server()
client = mymodule.ServiceClient(service_config)
self.assertTrue(client.service_is_up)

@test(groups=["service.shutdown"], \
depends_on_groups=["service.initialization", "service.tests"], \
always_run=True)
class StopService(unittest.TestCase):

def test_stop(self):
client = mymodule.ServiceClient(service_config)
if client.service_is_up:
mymodule.stop_web_server()
self.assertFalse(client.service_is_up())

Using Proboscis you can rest assured the tests will execute in the desired
order even if you add more test classes, change their name, or move them
to different modules.

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

proboscis-1.2.1.tar.gz (12.6 kB view details)

Uploaded Source

File details

Details for the file proboscis-1.2.1.tar.gz.

File metadata

  • Download URL: proboscis-1.2.1.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for proboscis-1.2.1.tar.gz
Algorithm Hash digest
SHA256 9b872e2f67441bec39244df16fd2fdc093b113ba3f3dab5f99bda5cfac73c79c
MD5 73b3aa712192ba4e8410491d00278655
BLAKE2b-256 cf9faeba3a197b57305ed253d66d37f798f68fbe63d79318f80eb71239dd5cb1

See more details on using hashes here.

Provenance

Supported by

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