Closed victorjzsun closed 2 years ago
Thanks for taking care of this. Actually what I meant in #125 is that, we still keep the assertions for tracer.events
, but instead of writing something like assert trace.events == [...]
in test code, we modify this check to something similar to the check of mocked_responses
, aka using json.
You removed the assert trace.events == [...]
, but I think they still provide values by ensuring the correctness of an eariler stage. This can help ease dedebugging, because we know at which stage (generation of events, or generation of RPC payload) the data goes wrong.
Could we generate the trace.events
from the existing json
data files? the events should be the same would seem a bit redundant to be put seperately. It would mean diff'ing the actual to intended might be a bit harder
Generating trace.events JSON from the existing json data files is fine, but eventually we need to be able to dump these JSON from the trace.events in memory. Imagine we add a field to the events, and we definitely don't want to manually update the golden files. We already support the golden file override feature for mock response, and it would be the same for trace.events.
I'm working on #126 to support Python 3.10. 3.10 changes bytecode quite a bit, so hard-code trace.events
in test doesn't work anymore. I'm looking forward to this feature😀
Btw, do you think get_value
in test/utils.py
can be removed once this is in?
I'm working on #126 to support Python 3.10. 3.10 changes bytecode quite a bit, so hard-code
trace.events
in test doesn't work anymore. I'm looking forward to this feature😀Btw, do you think
get_value
intest/utils.py
can be removed once this is in?
get_value
is also used in tracer.loops
assertions so not yet. I was planning on just focusing on tracer.events
for this PR and deal with tracer.loops
assertions in the next PR.
will do
On Wed, Oct 6, 2021 at 9:21 AM Victor Sun @.***> wrote:
@victorjzsun https://github.com/victorjzsun requested your review on:
133 https://github.com/laike9m/Cyberbrain/pull/133 Move assertions to
golden files.
— You are receiving this because your review was requested. Reply to this email directly, view it on GitHub https://github.com/laike9m/Cyberbrain/pull/133#event-5421770933, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATY3TK27LLHPETDYYUQQATUFRZSHANCNFSM5C2LTEHQ .
Overall it looks good now. Just a few nits.
Btw, once you're done with the modification, could you squash the commits? I've configured this repo to support it, but I'm not sure if you'll see a button or something else. Let me know if you met any issues.
Nvm, I just find that I can squash myself
Nvm, I just find that I can squash myself
Only collaborators have merge access so I can't even merge it regardless.
Perhaps I should add you as a collaborator then🙂 let me think about it
Anything else you want to add? If not, Im going to merge it.
Nope, go ahead 🙂
Merged. Thanks again for the great contribution!
Addresses #125. Replaces certain assertions to instead be checked using golden files.