Pythoscope: Unit test generation for Python.

by jesse in , ,


Recently, there was a thread on the testing-in-python mailing list around a proposal for a new tool called "Pythoscope" (discussion here). Pythoscope's mission - from the website is: "To create an easily customizable and extensible open source tool that will automatically, or semi-automatically, generate unit tests for legacy systems written in Python." To which my general response is "woop".

The initial version was released earlier this week. It has a launchpad site, and a detailed website.

This is pretty awesome. Just on a lark - I decided I'd run it against Python-trunk (what will become 2.6) - unfortunately, trying to generate tests for both the multiprocessing module and the threading module worked not. This is quite probably due to the fact I was not running it under the py2.6 binary on my machine, but rather the default python 2.5 - there's some confusion about the "with" keyword ;)

I'll unscrew my environment and get back to you on that one.

Otherwise, I ran it on some personal code, and it came up with a pretty decent series of test stubs. Then I decided to run it on svnmerge.py:

class TestGetRepoRoot(unittest.TestCase):
    def test_get_repo_root(self):
        assert False # TODO: implement your test here

class TestTargetToPathid(unittest.TestCase):
    def test_target_to_pathid(self):
        assert False # TODO: implement your test here

class TestSvnLogParser(unittest.TestCase):
    def test_object_initialization(self):
        assert False # TODO: implement your test here

    def test_object_initialization(self):
        assert False # TODO: implement your test here

    def test_revision(self):
        assert False # TODO: implement your test here

    def test_author(self):
        assert False # TODO: implement your test here

    def test_paths(self):
        assert False # TODO: implement your test here

Pretty neat - it generated all the stubs you could possibly think of. I am going to keep monkeying with it - and possibly contributing as it will save me a ton of time in the long run.