On Jun 30, 2016, at 18:37, Craig Rodrigues <rodrigc@crodrigues.org> wrote:

Hi,

The conversation about coverage exceptions came up due to this:

https://github.com/twisted/twisted/pull/261

I have that up to 97.87% of patch coverage.  I cannot merge it because the codecov integration with GitHub
is currently configured to not accept patches which don't have 100% patch coverage.

Can someone please take a look at that, and make a decision as to how to move that PR forward?
Thanks.

The problematic lines in question on this PR are here:

https://codecov.io/gh/twisted/twisted/compare/f43b16c097309d9747a0c1e708bd4ed05a6977e8...8a22bd8c626c8e496b9564879d85eb711e2bc408#747769737465642F746573742F746573745F64656665722E7079-2360

In this case, the fix to ensure they're covered is pretty easy.  The problem here is essentially a defect in the test: it's returning a Deferred from the test method to spin the reactor, even though the test has already done the work of isolating the system under test from the real reactor (self.lock is pointed at self._clock and a glance at the implementation shows it doesn't access the global reactor).

If you just fix the test to call self.successResultOf(d) after advancing the Clock to assert that it didn't fail, you can stop returning the Deferred, and remove the problematic un-covered callback.

More generally - although the ability to return a Deferred from a test is a very useful bit of integration testing functionality, tests within Twisted itself returning Deferreds are usually just insufficiently isolated.  We have a different way of doing integration tests with the reactors themselves (ReactorBuilder tests) which doesn't rely on returning Deferreds, and we don't have any tightly-coupled external systems like a database which it would make sense to rely upon in tests, so pretty much everything should be synchronous in our own test suite.

-glyph