-
Notifications
You must be signed in to change notification settings - Fork 64
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
Move conformance tests to a package extension #1954
Conversation
ecbefca
to
8031e79
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1954 +/- ##
==========================================
+ Coverage 88.18% 88.34% +0.15%
==========================================
Files 119 124 +5
Lines 30447 31400 +953
==========================================
+ Hits 26849 27739 +890
- Misses 3598 3661 +63 ☔ View full report in Codecov by Sentry. |
8031e79
to
1cd32fe
Compare
74c9ce0
to
3a1c470
Compare
Thanks! Renaming I think we should move away from the "random" bit. The idea is less about producing "random" data and more about producing / generating data that is "useful for testing". This may in particular focus on ensuring certain "important" values are generated frequently enough, such as corner and edge cases (e.g. when generting an In specification resp. property based testing (think QuickCheck, Hypothesis, etc.) I think the term "generator" is used, although it it still a slightly different (and more powerful!) concept. (Honestly I've been wondering for some time if it might be a good idea to look into using something like https://github.com/Seelengrab/Supposition.jl to get test case shrinking... but that's a discussion for another day ;-). Anyway, how about Then we could later potentially add |
72e995e
to
ee4e7be
Compare
Done |
I wonder whether the methods for |
The problem with that is that it makes composability very hard. Consider |
end | ||
end | ||
|
||
function equality_up_to_units(a, b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't realize we had this function; so this remarks is not directly for this PR, but I also don't forget: I think we can delete it and replace all calls to it by calls to is_associated
ConformanceTests.test_Ring_interface(L) | ||
ConformanceTests.test_Ring_interface_recursive(L) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we gain anything by adding the explicit ConformanceTest.
?
How about we instead add export test_Ring_interface
to module ConformanceTest
and then to use conformance tests one does using .ConformanceTest
(or something in that vein) instead of the current include(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl"))
but otherwise doesn't have to change anything...
Well, except for renaming test_elem
methods. But I am tempted to say that ConformanceTest
should for now also do const test_elem = generate_element; export test_elem
just to ease the transition. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we gain anything by adding the explicit
ConformanceTest.
?How about we instead add
export test_Ring_interface
to moduleConformanceTest
and then to use conformance tests one doesusing .ConformanceTest
(or something in that vein) instead of the currentinclude(joinpath(pathof(AbstractAlgebra), "..", "..", "test", "Rings-conformance-tests.jl"))
but otherwise doesn't have to change anything...
I am happy to add some exports to the ConformanceTest
module, but we have to draw a line somewhere. e.g. I really don't want to export things like equality
or even generate_element
(as the qualification at use-sites helps readers to remember what these functions are used for).
Well, except for renaming
test_elem
methods. But I am tempted to say thatConformanceTest
should for now also doconst test_elem = generate_element; export test_elem
just to ease the transition. Thoughts?
I explicitly decided against, as we can use the change in including the conformance tests to also then rename test_elem
. Otherwise, we get twice as much ugly glue code that needs to stay until some breaking release. Adapting downstream to the other needed changes (apart from the inclusion) should be pretty easy to do. I will prepare these, once this PR here is merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am in favor of not exporting anything.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that equality
should not be exported (the name is really bad for that). The functions I think would be useful to export are the test_*_conformance
functions. This way changes to adapt existing code to use the new package extension become minimal.
@thofma I don't understand what AbstractAlgebra.ConformanceTest
should not export anything? After all one still has the option to do import AbstractAlgebra.ConformanceTest
. To be clear, I am not suggesting that using AbstractAlgebra
should export any of those functions (I don't even think it could, given that this is a package extensions, but in any case I don't want it).
Makes sense |
Can we please merge this and continue discussions about what should be exported afterward? Otherwise, this will just become stale and get conflicts. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's get it merged and tune it afterwards
932497f
to
b154ce4
Compare
rebased due to conlficts |
Resolves #1936.
Changes:
TestExt
that depends onTest
being loaded. For older julia versions, this usesRequires.jl
.ConformanceTests
with function stubs and helpers, the implementations are in the TestExt.test_elem
is now a function stub inConformanceTests
, while the methods were moved to the respectivesrc
filestest_elem
got renamedgenerate_element
(name open for discussion)test/conformance-tests.jl
,test/Groups-conformance-tests.jl
, andtest/Rings-conformance-tests.jl
are only left for backwards compatibility. They load the relevant new files, and import things into the calling module (sometimes with a rename of things). They can be removed in an upcoming release, once the downstream packages have been adapted.