Extract TestRecord object from StreamToDict#158
Merged
jml merged 24 commits intotesting-cabal:masterfrom Nov 18, 2015
Merged
Conversation
No need to ever change it.
We don't want to accidentally iterate on TestRecord, say.
8598bd6 to
bc8b162
Compare
Member
Author
|
This is now ready for review. |
While they are probably OK to be exposed, let's keep this patch minimal & not news-worthy
Member
Author
|
Occurred to me that I didn't want to expose these yet. For now, it should just be an internal refactoring. |
jml
added a commit
that referenced
this pull request
Nov 18, 2015
Extract TestRecord object from StreamToDict
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Many places in
testtools.testresult.realrefer to "a dict as generated byStreamToDict" or similar. This patch dignifies it with a real name in Python,TestRecordThe new
TestRecordobject encapsulates most of the information in the dict and has been extracted fromStreamToDict.I've made it inherit from
pyrsistent.PClassto make it immutable. I think this is a desirable property, but not essential to the patch. We could make it mutable with attrs, or by rolling our own object like in the olden days.Notes
XXXcomments in where feedback is particularly welcomeTestRecordnorStreamToTestRecordis exposed, we can do that here or in a separate patchtesttools.testresult.realso I've tried very hard to avoid changing behaviour_stream. I held off because:TestRecordstores timestamps as a tuple. It occurred to me late in the piece that it would be clearer to usestart_timeandend_timeor similar.StreamToTestRecordfromStreamToDict, and then madeStreamToDictuse (rather than inherit from)StreamToTestRecordto do its thingContext
I'm looking at re-using some code from
testtools.testresult. This patch is in the spirit of "building understanding into existing code".