Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

[![Build Status](https://travis-ci.org/sixty-north/cosmic-ray.png?branch=master)](https://travis-ci.org/sixty-north/cosmic-ray) [![Code Health](https://landscape.io/github/sixty-north/cosmic-ray/master/landscape.svg?style=flat)](https://landscape.io/github/sixty-north/cosmic-ray/master) [![Documentation](https://readthedocs.org/projects/cosmic-ray/badge/?version=latest)](http://cosmic-ray.readthedocs.org/en/latest/)

# Cosmic Ray: mutation testing for Python

“Four human beings – changed by space-born cosmic rays into something more than merely human.” — The Fantastic Four

Cosmic Ray is a mutation testing tool for Python.

## N.B.! Cosmic Ray is still learning how to walk!

At this time Cosmic Ray is young and incomplete. It doesn’t support all of the mutations it should, its output format is crude, it only supports some forms of test discovery, it may fall over on exotic modules…[the list goes on and on](https://github.com/sixty-north/cosmic-ray/issues). Still, for the adventurous it does work. Hopefully things will improve fairly rapidly.

And, of course, patches and ideas are welcome.

## The short version

If you just want to get down to the business of finding and killing mutants, you still need to set a few things up.

### Install Cosmic Ray

First install Cosmic Ray. You can do this with pip:

` pip install cosmic_ray `

or from source:

` python setup.py install `

We recommend installing it into a virtual environment. Often it makes sense to install it into the virtual environment of the package you want to test.

### Install RabbitMQ and start a worker

Next you need to install [RabbitMQ](https://www.rabbitmq.com/). Cosmic Ray uses this message queue (via [Celery](http://www.celeryproject.org/)) to distribute testing tasks. Once installed, start the server. This is very platform-specific, so see the instructions for RabbitMQ on how to do this.

Once RabbitMQ is running, you need to start one or more Cosmic Ray worker tasks to listen for commmands on the queue. Start a worker like this:

` celery -A cosmic_ray.tasks.worker worker `

You can start as many workers as you want. Be aware that these workers - and the processes they spawn - need to be able to import the modules you want to test. As a result, you generally want to start them in the virtual environment into which you’ve installed Cosmic Ray.

### Create a session and run tests

Finally, you’re ready to start killing mutants. Cosmic Ray uses a notion of sessions to encompass a full mutation testing suite. Since mutation testing runs can take a long time, and since you might need to stop and start them, sessions store data about the progress of a run. The first step in a full testing run, then, is to initialize a session:

` cosmic-ray init --baseline=10 <session name> <top module name> -- <test directory> `

This will create a database file called <session name>.json. Once this is created, you can start executing tests with the exec command:

` cosmic-ray exec <session name> `

Unless there are errors, this won’t print anything.

### View the results

Once the execution is complete (i.e., all mutations have been performed and tested), you can see the results of your session with the report command:

` cosmic-ray report <session name> `

This will print out a bunch of information about the work that was performed, including what kinds of mutants were created, which were killed, and – chillingly – which survived.

[Further documentation is available at readthedocs](http://cosmic-ray.readthedocs.org/en/latest/).

Metadata

Release files for cosmic-ray 1.0.0a0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cosmic-ray 1.0.0a0
File Size Uploaded
cosmic_ray-1.0.0a0.tar.gz 20.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cosmic-ray 1.0.0a0
File Interpreter ABI Platform
cosmic_ray-1.0.0a0.macosx-10.10-x86_64.tar.gz Details

Total release size: 63.2 kB

Release files / cosmic_ray-1.0.0a0.tar.gz

Download URL cosmic_ray-1.0.0a0.tar.gz
Size 20.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3c1bac384473d916321eeebb973394fc95f5b7db94ac7044050f38e7a4a11c04
BLAKE2b-256 checksum
How to use checksums
a468ad55f290efc5bce129ffa251a71011ba3e6e11a0311fcd6a02400f296823
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / cosmic_ray-1.0.0a0.macosx-10.10-x86_64.tar.gz

Download URL cosmic_ray-1.0.0a0.macosx-10.10-x86_64.tar.gz
Size 43.1 kB
Tags Source
SHA-256 checksum
How to use checksums
75537a0039bb0fc5b80f74251cdd2caf39267ce30d5ececedd88b7800ad5d819
BLAKE2b-256 checksum
How to use checksums
e3d92fc7b24dfb9475bf3ee0011c51625cd77e24803ed896354d792bdc44d454
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

8.7.0

2 release files

8.4.6

2 release files

8.4.4

2 release files

8.4.3

2 release files

8.4.1

2 release files

8.3.15

2 release files

8.3.14

2 release files

8.3.13

2 release files

8.3.7

2 release files

8.3.5

2 release files

8.3.4

2 release files

8.3.3

2 release files

8.3.2

2 release files

8.3.1

2 release files

8.2.2

2 release files

8.2.1

2 release files

8.2.0

2 release files

8.1.0

1 release file

7.0.0

2 release files

6.1.1

2 release files

6.1.0

2 release files

6.0.1

2 release files

6.0.0

2 release files

5.6.2

2 release files

5.6.1

2 release files

5.5.1

2 release files

5.5.0

2 release files

5.4.0

2 release files

5.3.0

2 release files

5.2.2

2 release files

5.2.0

1 release file

5.1.1

1 release file

5.1.0

2 release files

3.3.0

2 release files

3.2.0

2 release files

3.1.2

2 release files

3.1.0

1 release file

3.0.6

2 release files

3.0.5

2 release files

3.0.4

2 release files

3.0.3

2 release files

3.0.2

2 release files

2.0.2

2 release files

2.0.1

3 release files

This release

1.0.0a0 This release

2 release files

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.0

2 release files

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