Skip to main content
[![CircleCI](https://circleci.com/gh/AndreaCensi/comptests.svg?style=shield)](https://circleci.com/gh/AndreaCensi/comptests)

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

Download files

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

Source Distribution

comptests-1.4.34.tar.gz (21.8 kB view details)

Uploaded Source

File details

Details for the file comptests-1.4.34.tar.gz.

File metadata

  • Download URL: comptests-1.4.34.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for comptests-1.4.34.tar.gz
Algorithm Hash digest
SHA256 09bf3a2e3b062879add62c62f3afb454f22474823992b3a8a9549af21614062d
MD5 6e61a856d2d11ba84bef53193af4ee37
BLAKE2b-256 7c1f79709787695701063936731f9a0519268ed453d8a3b36c19bb2c944f222c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.4.34 This release

1 file

1.4.33

1 file

1.4.32

1 file

1.4.31

1 file

1.4.30

1 file

1.4.29

1 file

1.4.28

1 file

1.4.27

1 file

1.4.26

1 file

1.4.25

1 file

1.4.24

1 file

1.4.23

1 file

1.4.22

1 file

1.4.21

1 file

1.4.20

1 file

1.4.19

1 file

1.4.18

1 file

1.4.17

1 file

1.4.16

1 file

1.4.15

1 file

1.4.14

1 file

1.4.13

1 file

1.4.12

1 file

1.4.11

1 file

1.4.10

1 file

1.4.8

1 file

1.4.7

1 file

1.4.6

1 file

1.4.5

1 file

1.4.4

1 file

1.4.3

1 file

1.4.2

1 file

1.3.9

1 file

1.3.8

1 file

1.3.7

1 file

1.3.6

1 file

1.3.5

1 file

1.3.4

1 file

1.3.3

1 file

1.3.2

1 file

1.3.1

1 file

1.3.0

1 file

1.2

1 file

1.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page