[tahoe-lafs-trac-stream] [Tahoe-LAFS] #2777: modernize tests (was: modernize tests, use "mock")

Tahoe-LAFS trac at tahoe-lafs.org
Mon Jan 13 20:03:40 UTC 2020


#2777: modernize tests
------------------------+-----------------------
     Reporter:  warner  |      Owner:
         Type:  task    |     Status:  new
     Priority:  minor   |  Milestone:  undecided
    Component:  code    |    Version:  1.11.0
   Resolution:          |   Keywords:
Launchpad Bug:          |
------------------------+-----------------------
Description changed by exarkun:

Old description:

> I'd like to clean up our unit tests.. there are a lot of archaic idioms
> that have crept in (partly because I'm not up-to-date on modern
> practices, partly because the tests were initially written before those
> practices were established). Here are some things that come to mind:
>
> * use [https://github.com/testing-cabal/mock "mock"] (which is kinda
> official now, added to stdlib as of py3.3) to shrink our 32 "Fake*"
> classes.
> * replace our home-grown `self.shouldFail` with
> `t.trial.unittest.assertFailure`
> * switch to `inlineCallbacks` to flatten the control-flow nest of helper
> functions

New description:

 I'd like to clean up our unit tests.. there are a lot of archaic idioms
 that have crept in (partly because I'm not up-to-date on modern practices,
 partly because the tests were initially written before those practices
 were established). Here are some things that come to mind:

 * switch from trial's TestCase to testtools' TestCase (probably via a base
 class in one of our common modules)
 * replace JUnit-style assertions (`assertEqual(...)`) with "hamcrest"
 style assertions (`assertThat(x, Equals(y))`)
 * switch to `inlineCallbacks` to flatten the control-flow nest of helper
 functions

--

--
Ticket URL: <https://tahoe-lafs.org/trac/tahoe-lafs/ticket/2777#comment:6>
Tahoe-LAFS <https://Tahoe-LAFS.org>
secure decentralized storage


More information about the tahoe-lafs-trac-stream mailing list