Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-25208: Fix broken test in lsst/alert_packet master #20

Merged
merged 3 commits into from Jul 7, 2020

Conversation

spenczar
Copy link
Contributor

@spenczar spenczar commented Jul 7, 2020

Ticket:

DM-25208

There were several issues:

  • The sample avro files generated into schema//sample_data/fakeAlert.avro were out of date. I have regenerated them, and included the code I used for that generation. I'm ambivalent on keeping those scripts. They seem handy, but a little redundant, but fixing the redundancy seems like more trouble than it's worth.
  • Schema equality checks weren't quite right. I needed to add a __eq__ method to them. (revealed in review to be redundant)
  • Error messages were confused, and didn't say which version was breaking, so I altered logging a bit.

Along the way, I'm marking .avro files as "binary" so they don't show up in diffs as a bunch of garbage.

This helps avoid them getting listed in diffs, which is too messy to
be useful.
Copy link
Contributor

@jdswinbank jdswinbank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that __eq__ is redundant, but assuming you agree (and remove it) I'm happy with this.

@@ -174,6 +174,10 @@ def __init__(self, schema_definition):
self.definition = resolve_schema_definition(schema_definition)
fastavro.schema._schema.SCHEMA_DEFS.clear()


def __eq__(self, other):
return self.definition == other.definition
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty similar to

def __eq__(self, other):
...?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It sure does, doesn't it. I don't know why a particular test had been failing intermittently, then, but it doesn't seem to fail anymore.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incidentally, today I learned that you can declare a method twice inside one class. Why on earth is that allowed? Ah, Python.

python/lsst/alert/packet/schema.py Outdated Show resolved Hide resolved
@spenczar spenczar merged commit 602a49a into master Jul 7, 2020
@spenczar spenczar deleted the tickets/DM-25208 branch July 7, 2020 23:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants