Skip to content

Conversation

@neilshweky
Copy link
Contributor

The idea was to follow PyMongo's lead here: mongodb/specifications#1206 (comment)

test.set_initial_data
lambda do
test.run
skip test.skip_reason if test.skip?
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we skip after running the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know of a way to skip inside the test, so I set the skip_reason and return from the test then have the actual skip happen right after.

Copy link
Contributor

Choose a reason for hiding this comment

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

My question is why skipping happens after test.run? Does it mean that we execute the test regardless of presence of a skip reason, and then just do not validate results?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well no, the idea is that the reason to skip happens inside the test. So in order to actually execute the skip I exit from the test early and call the skip outside of it (since skip is not accessible inside the test)

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, got it, thank you for the explanation!

# HACK: other errors are possible and likely will need to
# be added here later as the tests evolve.
end.should raise_error(Mongo::Error::OperationFailure)
rescue Mongo::Error::OperationFailure, Unified::Error::UnsupportedOperation
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@p-mongo can you look at this? is there an easier way to check against multiple errors?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would have done this the way you have done this.

# HACK: other errors are possible and likely will need to
# be added here later as the tests evolve.
end.should raise_error(Mongo::Error::OperationFailure)
rescue Mongo::Error::OperationFailure, Unified::Error::UnsupportedOperation
Copy link
Contributor

Choose a reason for hiding this comment

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

I would have done this the way you have done this.

@neilshweky neilshweky merged commit 0ad8262 into mongodb:master May 12, 2022
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.

4 participants