mardi 21 juillet 2015

Fuzzy unit testing in Python

I'd like to write a set of "fuzzy" unit tests in python. So far I've been using testtools, but switching to a different framework would be fine.

My test suite is aiming to test the performance of image-processing algorithms. I'd like to be able to have tests report fuzzy pass states. In other words, the results are "good enough" but it might be useful to investigate.

I have something like this:

suite = unittest.TestLoader().loadTestsFromTestCase(TestMyAlgorithm)
result = testtools.TestResult()

result.startTestRun()
try:
    suite.run(result)
finally:
    result.stopTestRun()

I'd like to use information in the result object to generate a report, but it looks like all of the information associated with passed tests has been tossed.

I'm wondering if I'm abusing the notion of a unit test to fit this sort of investigation.

Is there a standard way to perform this sort of testing in python?

Aucun commentaire:

Enregistrer un commentaire