Skip to content

tests: add CSV format test for v.db.select#7032

Merged
petrasovaa merged 2 commits intoOSGeo:mainfrom
Abhi-d-gr8:feat/6969-vdbselect-parson
Mar 18, 2026
Merged

tests: add CSV format test for v.db.select#7032
petrasovaa merged 2 commits intoOSGeo:mainfrom
Abhi-d-gr8:feat/6969-vdbselect-parson

Conversation

@Abhi-d-gr8
Copy link
Copy Markdown
Contributor

@Abhi-d-gr8 Abhi-d-gr8 commented Feb 2, 2026

Added test for the format=csv code path in v.db.select. The existing testComma test covers separator=comma which doesn't quote text fields, but format=csv follows RFC 4180 and wraps text fields in double quotes (e.g. "Zwe" instead of Zwe). This test makes sure that behavior is covered.

@github-actions github-actions bot added vector Related to vector data processing C Related code is in C module Python Related code is in Python tests Related to Test Suite CMake labels Feb 3, 2026
Copy link
Copy Markdown
Member

@wenzeslaus wenzeslaus left a comment

Choose a reason for hiding this comment

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

Since the code is touching format == CSV code, it would be good to test that beyond the one test which is there which is looking at the values but in a way abstracts the format itself. Add a test which is in the same style as testComma, but with format="csv". Attach screenshots which show the test actually runs and also that it fails if you intentionally introduce error into the code.

Similarly, extent test is missing as far as I can tell. We can't merge these without a clear proof these are actually running.

Comment thread vector/v.db.select/testsuite/test_v_db_select.py Outdated
Comment thread vector/v.db.select/main.c
Comment thread vector/v.db.select/main.c Outdated
Comment thread vector/v.db.select/main.c Outdated
@Abhi-d-gr8
Copy link
Copy Markdown
Contributor Author

Abhi-d-gr8 commented Feb 14, 2026

Hi @wenzeslaus, thanks for the detailed feedback.
I’ve added explicit test coverage for the paths you pointed out:

CSV format path: added testFormatCsv() in vector/v.db.select/testsuite/test_v_db_select.py, written in the same style as testComma, but using format="csv". This verifies the CSV-specific behavior (text fields quoted), so the format == CSV branch is now directly exercised.

Extent path: added testJSONExtent() covering -r with format=json, asserting that the output contains an extent object with numeric n/s/w/e keys.

To provide clear proof that these tests are actually running and meaningful, I’ve attached three screenshots:

  1. Full testsuite run passing.
  2. Testsuite run failing after intentionally introducing a regression (changing extent key n → x).
  3. The failure details showing the assertion triggered by the regression.
    This should demonstrate that both the CSV and extent code paths are covered and that the tests correctly detect breakage.

Let me know if you’d like an additional extent test for another output format as well.

image image image

@petrasovaa
Copy link
Copy Markdown
Contributor

Hi @Abhi-d-gr8, this is a good PR, but in the end I decided to go with #7076. I was thinking we could still merge the CSV test though, if you update your PR to contain just that.
Thanks for your understanding!

@Abhi-d-gr8 Abhi-d-gr8 force-pushed the feat/6969-vdbselect-parson branch from 866fb4b to 791708a Compare February 24, 2026 12:42
@Abhi-d-gr8
Copy link
Copy Markdown
Contributor Author

Hi @petrasovaa !,
Thanks for the feedback! I've updated the PR to contain just the CSV format test. The branch is now rebased on latest main (which includes #7076) and contains only a single test commit.
Also updating the title and description accordingly...
.

@Abhi-d-gr8 Abhi-d-gr8 changed the title v.db.select: rewrite JSON output using gjson library tests: add CSV format test for v.db.select Feb 24, 2026
@echoix echoix requested a review from wenzeslaus March 14, 2026 19:14
Copy link
Copy Markdown
Contributor

@petrasovaa petrasovaa left a comment

Choose a reason for hiding this comment

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

Sorry for the delay, I think this is good to go.

@petrasovaa petrasovaa enabled auto-merge (squash) March 18, 2026 02:40
@petrasovaa petrasovaa merged commit 5d3b800 into OSGeo:main Mar 18, 2026
26 checks passed
@github-actions github-actions bot added this to the 8.6.0 milestone Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C Related code is in C CMake module Python Related code is in Python tests Related to Test Suite vector Related to vector data processing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants