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

Add more aqua tests #892

Closed

Conversation

charleskawczynski
Copy link

@charleskawczynski charleskawczynski commented Sep 16, 2023

This PR adds and fixes more Aqua tests. I've put in some limits for the aqua tests, to prevent issues from worsening.

@devmotion
Copy link
Member

I still think we should go with #866. But it seems not everyone agrees.

@charleskawczynski
Copy link
Author

I still think we should go with #866. But it seems not everyone agrees.

Yeah, that’s exactly why I thought it would be good to add tests in this way. My hope is that this is not controversial, and the benefit is that things don’t get worse

@charleskawczynski
Copy link
Author

charleskawczynski commented Sep 16, 2023

I have no idea what’s going on with the tests though

# for method_ambiguity in ambs
# @show method_ambiguity
# end
@test length(ambs) ≤ 5
Copy link
Member

Choose a reason for hiding this comment

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

Is there a simple way to check which functions are ambiguous?

Copy link
Author

@charleskawczynski charleskawczynski Sep 22, 2023

Choose a reason for hiding this comment

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

We can use Aqua.test_ambiguities(StatsBase; recursive = true, exclude = [StatsBase.TestStat, Base.:(==)]). However, this doesn't test the number of ambiguities, only the functions.. Testing the number of ambiguities is nice, IMO, because we can even write this as:

    @test length(ambs)  5
    @test_broken length(ambs) < 5

so that we're alerted when it's fixed. It's also just easier to spread across the ecosystem than to collect all the functions after printing them all out..

Copy link
Author

Choose a reason for hiding this comment

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

I'm happy to change it if it means getting the PR merged.

end

@testset "Aqua tests (additional)" begin
Aqua.test_undefined_exports(StatsBase)
Copy link
Member

Choose a reason for hiding this comment

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

Just run Aqua.test_all and disable the ones you're handling separately? Then we won't miss out on new tests potentially added in the future.

Copy link
Author

Choose a reason for hiding this comment

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

While I do like the idea of not missing out on new tests in the future, my issue with test_all is that, if something does fail, then the simplest fix is often to call the individual test functions.

Aqua.test_stale_deps(StatsBase)
Aqua.test_deps_compat(StatsBase)
Aqua.test_project_extras(StatsBase)
Aqua.test_project_toml_formatting(StatsBase)
Copy link
Member

Choose a reason for hiding this comment

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

There's a bug currently and hence this should not be tested generally (see JuliaTesting/Aqua.jl#105). Hence I tend to use

Suggested change
Aqua.test_project_toml_formatting(StatsBase)
Aqua.test_all(
StatsBase;
project_toml_formatting=VERSION >= v"1.7" || !haskey(ENV, "GITHUB_ACTIONS"),
)
Aqua.test_project_toml_formatting(StatsBase; )

Copy link
Author

Choose a reason for hiding this comment

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

Alternatively, I'm fine with commenting this out.


# See: https://github.com/SciML/OrdinaryDiffEq.jl/issues/1750
# Test that we're not introducing method ambiguities across deps
ambs = Aqua.detect_ambiguities(StatsBase; recursive = true)
Copy link
Member

Choose a reason for hiding this comment

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

Why do we want to test ambiguities recursively? It's generally argued against that in JuliaTesting/Aqua.jl#77 (and against the default setting of testing Base and Core as well in the Aqua test suite).

Copy link
Author

Choose a reason for hiding this comment

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

I figured that it was more thorough.. I'm happy to change this to ambs = Aqua.detect_ambiguities(StatsBase)

Comment on lines +6 to +10
# This tests that we don't accidentally run into
# https://github.com/JuliaLang/julia/issues/29393
# Aqua.test_unbound_args(StatsBase)
ua = Aqua.detect_unbound_args_recursively(StatsBase)
@test length(ua) == 0
Copy link
Member

Choose a reason for hiding this comment

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

Can we just run the full Aqua test suite (see also my other comment below)? It's already included there by default: https://github.com/JuliaTesting/Aqua.jl/blob/3d5ed9fa2c915bbb06b2ef9037d57029d18bc8b5/src/unbound_args.jl#L36

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, I guess we can change it to the test function. I have my own gripe with that interface, tbh. JuliaTesting/Aqua.jl#180

@charleskawczynski
Copy link
Author

This doesn't seem to have any traction. Closing.

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.

3 participants