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

Change show_source tests into integration tests #793

Merged
merged 3 commits into from
Nov 28, 2023

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Nov 28, 2023

It's always tricky to write show_source tests as the state change would affect ruby/ruby's CI. So this change will stop them from running on ruby/ruby (because we skip integration tests there) but also make sure each test don't affect each other.

I also spotted a small bug when improving tests and fixed it here too.

Because show_source tests often need to define class and/or methods,
they can easily leak state to other tests. Changing them to integration
tests will ensure that they are run in a clean environment.
@st0012 st0012 added the bug Something isn't working label Nov 28, 2023
@st0012 st0012 requested a review from a team November 28, 2023 16:59
@@ -77,6 +77,8 @@ def method_target(owner_receiver, s_count, method, type)
target_method = target_method.super_method if target_method
end
target_method.nil? ? nil : target_method.source_location
rescue NameError
Copy link
Member Author

Choose a reason for hiding this comment

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

We can do more sophisticated rescue for individual instance_method and method calls. But for now with all the tests I think we can assume it's unlikely the logic itself would cause NoMethodError.

Copy link
Member

@tompng tompng left a comment

Choose a reason for hiding this comment

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

👍

@tompng tompng merged commit 3c39f13 into master Nov 28, 2023
22 of 24 checks passed
@tompng tompng deleted the improve-show-source-tests branch November 28, 2023 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging this pull request may close these issues.

2 participants