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.0.tar.gz (12.5 kB view details)

Uploaded Source

File details

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

File metadata

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

File hashes

Hashes for proboscis-1.2.0.tar.gz
Algorithm Hash digest
SHA256 1a512329907aac0215d941957313dee2265d2849096e21999d7c8c2594e6eaaa
MD5 303e27bf7dfd8ccc935b0c6881c0abb4
BLAKE2b-256 f0361536013d5ac913d547541bc2a7bf8a7054761825481c8326ca0dda3bf419

See more details on using hashes here.

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