HealthChecks

hospital provides a set of health check suites you can customize.

Packaging

Healthchecks related to Python packaging.

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

Bases: unittest.case.TestCase

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_name = 'hospital'

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

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.

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).
is_healthcheck = True

Predictable

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

class hospital.healthchecks.predictable.ForeverPassingHealthCheck(methodName='runTest')

Bases: unittest.case.TestCase

Health check that forever passes.

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.

is_healthcheck = True
class hospital.healthchecks.predictable.ForeverSkippedHealthCheck(methodName='runTest')

Bases: unittest.case.TestCase

Healthcheck that is always skipped.

test_skip()

Health checks can be skipped.

is_healthcheck = True