Opened 6 years ago

Closed 6 years ago

#9873 closed enhancement (fixed)

Convert BridgeDB's old unittests to use twisted.trial

Reported by: isis Owned by: isis
Priority: Medium Milestone:
Component: Circumvention/BridgeDB Version:
Severity: Keywords: bridgedb-unittests
Cc: isis Actual Points:
Parent ID: #9865 Points:
Reviewer: Sponsor:


twisted.trial has a conversion utility class for translating test results from stdlib unittest into something which trial's reporter can use. I've never used it, but either some sort of conversion should be done of the old tests, or they should be rewritten.

Additionally, all the tests are in one file, lib/bridgedb/, which imports al of the modules in the bridgedb package, and also makes it a bit hard to follow which test is testing what.

We should also probably re-evaluate whether the class Test(setuptools.Command) in is still necessary.

Child Tickets

Change History (2)

comment:1 Changed 6 years ago by isis

Status: newneeds_revision

I've started working on this in my branch fix/9873-convert-old-unittests.

I began setting up a system which will run the old lib/bridgedb/ unittests with Twisted's trial runner. The old unittests will get run twice, once with removed/deprecated classes and functions which have been taken out of BridgeDB's codebase, and again with new/refactored code; this way, the old unittests function as a (partial) regression test suite.

The way I designed it, the removed/old/deprecated/original code (various classes/functions before I refactored them) will go into lib/bridgedb/test/, and it is twisted.python.monkey.MonkeyPatched into place for a run of the old unitests in lib/bridgedb/ Then, the old unittests are run a second time with the newly refactored code, so that the difference between the two can be clearly seen, and bugs introduced by new code can (hopefully) be caught immediately.

comment:2 Changed 6 years ago by isis

Resolution: fixed
Status: needs_revisionclosed

This is done in my branch fix/9873-convert-old-unittests_r3. And CI is passing! And we now have hella coverage (hella~=50%).

I had to force bridgedb.Tests.BridgeStabilityTests.testDiscountAndPruneBridgeHistory() to be skipped on Travis-CI boxes because it was hanging (it takes about 8 minutes to run locally, and it passes locally).

This is fixed.

Note: See TracTickets for help on using tickets.