Skip to main content

Testing utilities for projects that use ConfTools for handling their configuration.

Project description

comptests
=========

Testing utilities built on top of [ConfTools][conftools], [CompMake][compmake]
and [QuickApp][quickapp].


Basic Usage
-----------

This is the usage for packages that register objects using [ConfTools][conftools].

# Defining tests

Call the function ``comptests_for_all`` to create a decorator:

# get the library (ObjSpec)
library_robots = get_conftools_robots()

# Create a test decorator
for_all_robots = comptests_for_all(library_robots)

# Use the decorator to specify tests. Test functions
# must take two arguments: id object and object itself

@for_all_robots
def check_robot_type(id_robot, robot):
assert isinstance(robot, RobotInterface)

You can also register tests for pairs:

library_nuisances = get_conftools_nuisances()
for_all_robot_nuisance_pairs = comptests_for_all_pairs(library_robots, library_nuisances)

@for_all_robot_nuisance_pairs
def check_nuisances_obs(id_robot, robot, id_nuisance, nuisance):
check_conversions(robot.get_spec().get_observations(), nuisance)

# Running tests

Use the command line:

comptests <module>

This looks for the ``get_comptests()`` function in ``<module>``:

def get_comptests():
get_comptests():
# get testing configuration directory
from pkg_resources import resource_filename
dirname = resource_filename("boot_agents", "configs")
# load unittests
from . import unittests
from comptests import get_comptests_app
# Get the Quickapp for the boot_config
app = get_comptests_app(get_boot_config())
return [app]

Finding coverage information
============================

It's very usuful to use the ``coverage`` tool together with comptests.

Install the ``coverage`` tool:

pip install coverage

If ``coverage`` is installed then comptests automatically computes
the coverage information for nosetests execution.

To do the coverage information for the comptests, run like this:

coverage run =comptests -c "make recurse=1" <package>

Note that you cannot use parallel testing (using ``parmake``) otherwise
coverage gets confused.

This displays the results:

coverage report -m

Then create the HTML report:

coverage html -d outdir

Project details


Release history Release notifications

This version
History Node

1.4.24

History Node

1.4.23

History Node

1.4.22

History Node

1.4.21

History Node

1.4.20

History Node

1.4.19

History Node

1.4.18

History Node

1.4.17

History Node

1.4.16

History Node

1.4.15

History Node

1.4.14

History Node

1.4.13

History Node

1.4.12

History Node

1.4.11

History Node

1.4.10

History Node

1.4.8

History Node

1.4.7

History Node

1.4.6

History Node

1.4.5

History Node

1.4.4

History Node

1.4.3

History Node

1.4.2

History Node

1.3.9

History Node

1.3.8

History Node

1.3.7

History Node

1.3.6

History Node

1.3.5

History Node

1.3.4

History Node

1.3.3

History Node

1.3.2

History Node

1.3.1

History Node

1.3.0

History Node

1.2

History Node

1.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
comptests-1.4.24.tar.gz (21.2 kB) Copy SHA256 hash SHA256 Source None Apr 4, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page