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

Avoid duplicate includes causing warnings in tests #689

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ararslan
Copy link
Member

@ararslan ararslan commented Jul 2, 2024

Currently we're calling include in a loop over supported backends. The files being included contain definitions which get overwritten when include is called a second time, resulting in a lot of warnings that make the test logs noisy. The approach taken here to address this is to wrap things in expressions, define an anonymous module inside of the loop over backends, Core.eval the expressions into the anonymous module, and Base.include the files into it. There are better ways to do this but this should get the job done with minimal required changes.

Fixes #685.

Currently we're calling `include` in a loop over supported backends. The
files being `include`d contain definitions which get overwritten when
`include` is called a second time, resulting in a lot of warnings that
make the test logs noisy. The approach taken here to address this is to
wrap things in expressions, define an anonymous module inside of the
loop over backends, `Core.eval` the expressions into the anonymous
module, and `Core.include` the files into it. There are better ways to
do this but this *should* get the job done with minimal required
changes.
test/runtests.jl Outdated Show resolved Hide resolved
@ararslan
Copy link
Member Author

ararslan commented Jul 3, 2024

A bit cursed but does seem to work

Copy link
Member

@quinnj quinnj left a comment

Choose a reason for hiding this comment

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

I personally think this makes the testing quite a bit more messy/hard to follow. Having some comments explaining all the evals would certainly help, but I think I'd much prefer splitting things up into proper test-util submodules that can be loaded normally in teh top-level runtests.jl and then relative imported in other submodules. I know it's a bit more rearranging, but I think ti would at least be more approachable/sensible for others who come along and want to contribute.

@ararslan
Copy link
Member Author

ararslan commented Jul 8, 2024

100% agree with that. This was the path of least effort, haha. I'll see if I can revisit this soon but in the meantime, for anybody reading this, do feel free to implement Jacob's suggestion in your own PR.

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.

Fix method overwrite warnings in tests
2 participants