Ticket #5955 enhancement closed fixed

Opened 20 months ago

Last modified 13 months ago

Move inlineCallbacks test from twisted.test.test_failure to somewhere better (test_defer?)

Reported by: itamar Owned by: thijs
Priority: normal Milestone:
Component: core Keywords:
Cc: thijs Branch: branches/move-inlinecbtest-5955
(diff, github, buildbot, log)
Author: thijs Launchpad Bug:

Description

Importing twisted.internet in a twisted.python test module is not ideal. The tests involving inlineCallbacks in test_failure should probably be moved somewhere else, e.g. the relevant test_defer.

Change History

1

  Changed 14 months ago by thijs

  • branch set to branches/move-inlinecbtest-5955
  • branch_author set to thijs

(In [37306]) Branching to 'move-inlinecbtest-5955'

2

  Changed 14 months ago by thijs

(In [37307]) move test, add news file. refs #5955

3

  Changed 14 months ago by thijs

  • keywords review added

Forced a  build.

  1. moved test to test_defer
  2. the test uses getDivisionFailure from test.test_failure. it's being imported now but it seems better to expose this elsewhere (or maybe duplicate)?
  3. moved the py3 todo statement and added notes about #6008 being a unittest todo support ticket, found it confusing with the #5949 right above it..

Up for review.

4

follow-up: ↓ 5   Changed 14 months ago by tom.prince

  • keywords review removed
  • owner set to thijs
  1. Rather than importing getDivisionFailure, you can probably just duplicate it as a local function.
  2. The test should use failureResultOf to extract the failure from the deferred.
  3. The assertion could be made much stronger (and match the docstring) if the entire extracted traceback was compared to the original traceback.

Please resubmit for review after addressing the above points.

5

in reply to: ↑ 4   Changed 14 months ago by thijs

  • cc thijs added
  • owner thijs deleted
  • keywords review added

Replying to tom.prince:

1. Rather than importing getDivisionFailure, you can probably just duplicate it as a local function.

Done.

2. The test should use failureResultOf to extract the failure from the deferred.

Fixed.

3. The assertion could be made much stronger (and match the docstring) if the entire extracted traceback was compared to the original traceback.

The assertion has been expanded, and while it's an improvement, i couldn't figure out how to get the original traceback to compare to, but it also feels this is more out of scope for this ticket.

Forced a new  build.

6

  Changed 13 months ago by tom.prince

  • owner set to thijs
  • keywords review removed

This looks good. Please merge.

3. The assertion could be made much stronger (and match the docstring) if the entire extracted traceback was compared to the original traceback.

The assertion has been expanded, and while it's an improvement, i couldn't figure out how to get the original traceback to compare to, but it also feels this is more out of scope for this ticket.

I like the new assertions. It would be nice if there was some helpers for doing this, so that the reader doesn't need know how tracebacks look.

7

  Changed 13 months ago by thijs

  • status changed from new to closed
  • resolution set to fixed

(In [37859]) Merge move-inlinecbtest-5955: Move test_inlineCallbacksTracebacks from test_failure to test_defer.

Author: thijs Reviewer: tom.prince Fixes: #5955

Note: See TracTickets for help on using tickets.