Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Capture functions arguments and results to create a unit test file for that combination, to assist refactoring.

Project Description

Create tests from current behaviour
Imagine you have to refactor a large, undocumented (hence untested!) python code base.

This utility captures this functionality by generating test cases during test executions of the code. This assists refactoring as the current expected behaviour has been captured.

Why 'Astrotest'?

'Astroturfing' is a term meaning to create inauthentic comments or discussion to influence or overwhelm natural organic debate. Hence 'Astro-testing': it's not authentically TDD; it can create a large number of tests automatically.


If the following function has the test_logging decorator::

def simplefn(a,b):
return a+b

and is called with:


it'll create a unit test file with the following (comments etc. omitted):

def test_simplefn(self):
self.assertEqual(simplefn(a=1, b=2), 3)

Release History

This version
History Node


History Node


History Node


Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting