-
Notifications
You must be signed in to change notification settings - Fork 4
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 macro to test all implementations #135
Conversation
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.
Looks good, but every test file will have to include("helper.jl")
because they're wrapped inside SafeTestsets
.
test/helpers.jl
Outdated
end | ||
end | ||
quote | ||
for mod in (GeoInterface, ArchGDAL, GeometryBasics, LibGEOS) |
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.
Might be nice to pull these out to the top of the file as a const
list to make it clear which ones are tested without having to skim the whole file. Also, that way if other geometries make it into the scene we can easily add to the test.
Also, do we want the GeoInterface
conversion to be tuples
? Or do we not care about the point type here?
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'll move it up. Hopefully the point type doesn't matter much...
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 glad we have this. In a few places I was trying to make examples of different types of geometries to test this. It is nice that this is automated now.
5c749cb
to
887dfcf
Compare
I can deal with the GeometryBasics stuff today, will push a change to the CI to use that branch once I have. |
Looks like the |
cfe3378
to
a0a76f8
Compare
@asinghvi17 do you want to update the barycentric tests with |
Sure, will push it up in a bit. |
Does this mean we should add GeometryOps as reverse dependency test to these other packages? |
Maybe at some stage. We could add an env var to only test one package |
test/methods/geom_relations.jl
Outdated
@test_all_implementations (g1, g2) begin | ||
if swap_points | ||
g1, g2 = g2, g1 | ||
sg1, sg2 = sg2, sg1 | ||
end | ||
go_val = GO_f(g1, g2) | ||
lg_val = LG_f(g1, g2) | ||
@test go_val == lg_val | ||
go_val != lg_val && println("\n↑ TEST INFO: $sg1 $f_name $sg2 - $sdesc \n\n") | ||
end |
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.
This is killing test logs - it is literally impossible to read them because of the number of testsets. There must be a better way to handle this case - maybe using an external loop over the modules instead of an internal one over the geometries?
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.
Inverting the loop wont change the amount of printing as its in the middle already/either way.
I think we instead need to remove that line? Maybe we could make it a testset instead?
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 don't think the printing is an issue because as we fix the test cases, those will naturally fix themselves. I guess the problem is that each case has an individual testset - we should change that so that each module just runs all the test cases instead.
Maybe in this case we could use an explicit loop instead of the macro?
This will be upstreamed later, but it's easier to keep track here
8121476
to
a3af803
Compare
* Move types to a new `types.jl` file so they are more accessible and general * Add GEOSCorrection and LibGEOSExt * Minor fixes * Write out stubs for not-yet-implemented functions * Implement `GEOS` algorithm * Update ext/GeometryOpsLibGEOSExt/segmentize.jl * switch from typed keys to no keys * fix erroneous typing in buffer * add test skeleton + move enforce to GO proper * Switch to SafeTestsets for tests This is meant to assure that conflicts in e.g. polygon definitions are avoided, and that tests are immediately runnable as files. * Test segmentize properly * Apply suggestions from code review * Fix tests * Allow LibGEOS to perform natural conversion on DE-9IM and poly set ops * Describe exactly why the filter statement exists in the extension * Remove GEOS correction (not working yet) * Add TopologyPreserve simplification method * Add a basic comment to not_implemented_yet.jl * Add a "default" implementation for buffer that returns GO geoms * Switch back to explicit conversion to LG in all simple overrides * Fix incorrect references * Add Downloads and NaturalEarth to the test env * Fix primitive tests * Add a hack for LibGEOS geometrycollection conversion * Fix accidental swapping in x and y in test * Add overlaps testing for GEOS * Bump version to v0.1.7 (#150) * Set compat for LibGEOS to be after the GeometryCollection patch * Force `simplify` to always be called with GEOS() for GEOS functions * Go back to regular testsets from SafeTestsets * Revert the geom relations tests for #135 * Get simplify working as well * Activate the LibGEOS listed tests * Fix the segmentize test * Fix buffer
I'm going to make a PR that changes the implementation to be a custom |
@asinghvi17 did you end up working on this? otherwise I can finish it |
I am currently on the road so haven't got anything done...go for it! Are you doing this in the a and b list generators? |
not sure you mean by a and b list generators... |
Do you know if there is a macro utility other packages use to walk the AST and replace It seems like a generic thing someone has written
|
Oops, somehow I confused this for the other issue. I did a bit of work on this, will push it tomorrow! |
BenchmarkTools probably has something for the var stuff |
Ok BenchmarkTools Its small enough to just copy/paste |
This should be good to go. I think I've made the printing a bunch shorter. But its still mostly the I've also actually used SafeTestsets.jl (we depended on it but didnt use it) and updated everything for that. One thought I have is we should show wherever we are manually skipping packages - like maybe print a warning about it? |
I guess I'm not totally clear on where the setup code needs to be package specific?
👍
What defines "skipping packages"? E.g. GeometryBasics doesn't support geometrycollections out of the box... Similarly I don't think there's infrastructure to One thought I had was to define e.g. |
|
||
export @test_implementations, @testset_implementations | ||
|
||
const TEST_MODULES = [GeoInterface, ArchGDAL, GeometryBasics, LibGEOS] |
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.
Should this be configurable by Preferences.jl or an env variable?
Overall, aside from those comments, I think we should merge! |
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'm sold!
By skipping I mean manually passing a subset of the defaults - so we would notify about skips by just getting the setdiff of the passed modules and the standard ones and putting it in |
WIP conversion of all tests to use our new
@test_all_implementations
macro to make sure all geometries work everywhere.@asinghvi17 I added some helpers for nicer testset titles that combine the topic and the module name.
Closes #134
(probably doesn't work currently !)
GI.convert
for features and feature collections so we cant pass features into the macro. We should add it to GeoInterface with a fallback that just converts the geometries and rewraps them with GI Feature.