hospital Package

hospital Package

hospital provides supervision/monitoring utilities for Python projects.

class hospital.__init__.HealthCheck(methodName='runTest')

Bases: unittest.case.TestCase

Shortcut to hospital.healthcheck.HealthCheck.

is_healthcheck = True

healthcheck Module

Healthchecks: harmless tests (PROD compatible).

Health checks are meant to run on any live instance, such as a PROD environment. They are part of the monitoring/supervision toolkit.

class hospital.healthcheck.HealthCheck(methodName='runTest')

Bases: unittest.case.TestCase

Base class for health checks, extends unittest.TestCase.

is_healthcheck = True

Custom attribute that identifies health checks.

Allows easier selection of tests you want to run. See also nose’s attrib plugin or unittest’s skip feature.

loading Module

Utilities to discover and load health checks.

class hospital.loading.HealthCheckLoader

Bases: unittest.loader.TestLoader

Encapsulate HealthCheck loading.

This is a special TestLoader which makes sure instances are actually health checks.

Warning

Since this loader can be called with arguments provided by users (GET requests), we have to make sure user input is safe. As an example, we can’t accept to load health checks from any callable, because this callable could be anything.

filter_suite(suite)

Return copy of TestSuite where only health checks remain.

is_health_check(value)

Return True if value is an health check.

Proxy to :py:attr:`` Tests is_healthcheck attribute of value.

loadTestsFromModule(module)
loadTestsFromName(name, module=None)

Same as unittest.TestLoader.loadTestsFromName, but restricted to health test objects, i.e. no callable allowed.

loadTestsFromNames(names, module=None)

packaging Module

Healthchecks related to packaging.

class hospital.packaging.DistributionHealthCheck(methodName='runTest')

Bases: hospital.healthcheck.HealthCheck

Several checks related to project’s distribution.

The simplest way to reuse this healthcheck is to inherit from it and customize the distribution_name attribute.

distribution = None

Distribution instance. This is a class attribute in order to share it between test methods. It is to be populated by get_distribution() during setup.

distribution_name = 'hospital'

Distribution name. This is a class attribute in order to share it between test methods.

get_distribution()

Return distribution instance from distribution_name.

setUp()

Setup distribution.

test_python_version()

Make sure project runs on supported Python version.

This healthcheck focuses on compatibility of project within environments that actually use it, whereas unit tests take care of:

  • supported Python versions declaration (setup.py, setup.cfg).
  • project was developed within supported environment(s).

predictable Module

Predictable health check, i.e. they always have the expected behaviour.

class hospital.predictable.PredictableHealthCheck(methodName='runTest')

Bases: hospital.healthcheck.HealthCheck

Health check that give predictable results.

Useful to check that health checks can be run, discovered, or to check their output.

As an example, once you have setup your environment, you should be able to collect this health check and run it sucessfully, or it would mean there is something wrong with your setup... Configuration of health check discovery could be the cause.

test_true()

Health checks are collected.

Read the Docs v: 0.1
Versions
latest
0.1
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.