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

v.build: added tests for v.build module #5061

Draft
wants to merge 83 commits into
base: main
Choose a base branch
from
Draft
Changes from 5 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
a7c76ee
Added tests for v.build module
Shreshth-Malik Feb 7, 2025
d50cd86
doc: Fix parson lib test first keyword (#5060)
wenzeslaus Feb 7, 2025
c14f9f4
r.describe: initialize some variables (#5039)
nilason Feb 7, 2025
63107d2
v.distance: initialize variable; remove unused variables (#5043)
nilason Feb 7, 2025
acb276f
g.proj: fix resource leaks (#5042)
nilason Feb 7, 2025
69a9b89
v.to.3d: initialize some variables (#5040)
nilason Feb 7, 2025
4ff9373
docs: Update contributing docs to refer to `ruff format` (#5027)
echoix Feb 7, 2025
bd2ebf3
docs: Add more HTML to Markdown Lua filters (#5054)
cwhite911 Feb 7, 2025
a82a39f
doc: Convert HTML to Markdown (#5064)
wenzeslaus Feb 8, 2025
25e198f
CI(deps): Update github/codeql-action action to v3.28.9 (#5069)
renovate[bot] Feb 8, 2025
7f86b76
CI(deps): Update ruff to v0.9.5 (#5070)
renovate[bot] Feb 8, 2025
2f87135
CI(deps): Update ubuntu:22.04 Docker digest to ed1544e (#5068)
renovate[bot] Feb 8, 2025
708fe06
CI(deps): Update docker/setup-buildx-action action to v3.9.0 (#5071)
renovate[bot] Feb 8, 2025
66050f0
CI(deps): Update docker/setup-qemu-action action to v3.4.0 (#5072)
renovate[bot] Feb 8, 2025
35926d3
Added fixes and suggestions
Shreshth-Malik Feb 8, 2025
6a89b65
style: Ruff rules maintenance (#5073)
echoix Feb 8, 2025
2b7a3f3
CI: Run ruff format with file fixes for PR suggestions (#5074)
echoix Feb 9, 2025
d861511
v.info: Add JSON output for history (#4989)
NishantBansal2003 Feb 9, 2025
dc6e4c1
lib/raster: Fix Resource Leak issue in quant_io.c (#5076)
ShubhamDesai Feb 9, 2025
7361d0b
Patch for failing test due to temp map name
Shreshth-Malik Feb 10, 2025
9f9be39
i.biomass: added test file for i.biomass module (#4962)
jayneel-shah18 Feb 10, 2025
5fe1b99
style: Fix missing-f-string-syntax (RUF027) (#5031)
echoix Feb 10, 2025
1c93c80
lib/vector/Vlib: Fix Resource leak issue in remove_areas.c (#5078)
ShubhamDesai Feb 10, 2025
4e3e14c
lib/vector/Vlib: Fix Resource Leak issue in open_nat.c (#5080)
ShubhamDesai Feb 10, 2025
be43b74
raster/r.statistics: Fix Resource Leak issues (#5077)
ShubhamDesai Feb 10, 2025
a27e3c1
r.sim: cleanup of global variables (#5044)
petrasovaa Feb 11, 2025
bd67b98
doc: Enable Markdown doc compilation (#5048)
wenzeslaus Feb 11, 2025
67cb26b
Translations update from OSGeo Weblate (#4063)
osgeoweblate Feb 11, 2025
6e44916
config: Updated .gitignore paths to ignore python environments and vs…
cwhite911 Feb 12, 2025
6c2a040
docs: Added command to serve mkdocs locally (#5089)
cwhite911 Feb 12, 2025
b624fc2
docs: fix code snippet languages (#5095)
petrasovaa Feb 12, 2025
72e8c26
ci: Remove Travis-CI (#5099)
wenzeslaus Feb 12, 2025
e569a1a
docs: fix building markdown documentation (#5100)
petrasovaa Feb 13, 2025
99cdc5b
build: Fix g.extension test (#5102)
petrasovaa Feb 13, 2025
9c11460
docs: fix markdown image syntax in imagery, display, misc, ps tools a…
petrasovaa Feb 13, 2025
c1849f5
doc: Redefine r.mapcalc build dependencies for color table thumbnails…
wenzeslaus Feb 13, 2025
1c1d01d
docker: build gdal-grass with CMake (#5106)
nilason Feb 13, 2025
6b652b6
docker: pin gdal-grass version to 1.0.3; add cmake dep (#5108)
nilason Feb 13, 2025
adda9a9
r.sim: Fix incorrect expressions reported by Coverity Scan (#5097)
petrasovaa Feb 13, 2025
7802ac2
docs: fix markdown documentation of GUI tools (#5086)
petrasovaa Feb 13, 2025
ffc0b8c
docs: fix markdown image syntax in raster tools (#5092)
petrasovaa Feb 13, 2025
c0fe7d7
docs: fix markdown image syntax in vector tools (#5093)
petrasovaa Feb 13, 2025
3ddc3d7
GUI: Use for Markdown documentation if available (#5066)
petrasovaa Feb 13, 2025
442bd61
g.manual: Use new Markdown docs if available (#5110)
petrasovaa Feb 13, 2025
3913be0
lib/vector/Vlib: fix segfault introduced with #5038 (#5109)
metzm Feb 13, 2025
7ad9e95
r.fillnulls: Modified tests for r.fillnulls module (#5026)
Shreshth-Malik Feb 13, 2025
d3993e2
docker: Fix git clone path in Dockerfile for gdal-grass (#5111)
echoix Feb 14, 2025
a2413bf
Fixed output parsing
Shreshth-Malik Feb 14, 2025
5546b2d
Fixed build fails due to temp meta data
Shreshth-Malik Feb 14, 2025
4173c3d
style: Fix SIM115: Simplify if statement in t.list and PTH201 in v.fi…
arohanajit Feb 14, 2025
2bc4035
docs: Reorganize mkdocs file and nav (#5096)
cwhite911 Feb 14, 2025
3ab4f38
r.category: Add output color_format option (#5011)
NishantBansal2003 Feb 14, 2025
d657e54
docker: build gdal-grass with grass in working condition (#5115)
nilason Feb 14, 2025
1062c2f
docker: Enable cache for Docker builds (#3821)
echoix Feb 14, 2025
61e38c2
docker: move gdal-grass driver build stage after grass build relocati…
nilason Feb 14, 2025
158e578
CI(deps): Update ruff to v0.9.6 (#5122)
renovate[bot] Feb 15, 2025
ea58114
docs: Fix Markdown linting issues heading-increment and no-duplicate-…
petrasovaa Feb 15, 2025
50d61e9
CI: Fix Docker caching with GitHub Actions (#5126)
echoix Feb 15, 2025
bab037a
CI(deps): Update alpine:3.21 Docker digest to a8560b3 (#5121)
renovate[bot] Feb 16, 2025
d8d8d84
CI(deps): Update flake8 to v7.1.2 (#5131)
renovate[bot] Feb 16, 2025
2f7de93
lib/vector/Vlib: free alloc'd field_info and dbColumn objects (net_bu…
nilason Feb 17, 2025
33f29c1
CI(Docker): Docker workflow improvements (#5128)
echoix Feb 17, 2025
2854e29
CI: add macOS app bundle distribution workflow (#5118)
nilason Feb 18, 2025
7bfe274
docker: hardcode versioned GISBASE path on Alpine (#5137)
nilason Feb 18, 2025
938b9ad
gui(web_services): Fix not all arguments converted during string form…
echoix Feb 18, 2025
4d49111
style: Fixed context opening error in wxGUI/dbmgr (#5062)
arohanajit Feb 18, 2025
688e625
docs: fixing no-inline-html liniting error, part 1 (#5120)
petrasovaa Feb 18, 2025
cdf9fe7
g.extension: Fix Markdown compilation for addons (#5141)
petrasovaa Feb 19, 2025
c1da5fd
docs: mkdocs edit and view on github (#5114)
cwhite911 Feb 19, 2025
41c4b1d
docs: fix no-emphasis-as-heading in Markdown files (#5140)
petrasovaa Feb 19, 2025
bfe6ba0
r.in.srtm: Fixed SIM115, FURB103, FLY002 by adding context manager, f…
arohanajit Feb 19, 2025
ea470fa
docs: fix missed MD051/link-fragments (#5147)
petrasovaa Feb 19, 2025
5f4fa06
docs: fix no-inline-html (span tag only) (#5148)
petrasovaa Feb 20, 2025
83e7fe7
CI(Docker): Simplify job names with only the OS (#5156)
echoix Feb 20, 2025
de7a97a
docs: fix remaining no-inline-html (#5149)
petrasovaa Feb 20, 2025
1633be4
docs: fix no-alt-text (#5154)
petrasovaa Feb 20, 2025
ff9659d
Added tests for v.build module
Shreshth-Malik Feb 7, 2025
01246cb
Added fixes and suggestions
Shreshth-Malik Feb 8, 2025
3ffdc09
Patch for failing test due to temp map name
Shreshth-Malik Feb 10, 2025
cb70e67
Fixed output parsing
Shreshth-Malik Feb 14, 2025
93bb233
Fixed build fails due to temp meta data
Shreshth-Malik Feb 14, 2025
21a5ba7
Moved build_module calculation and added fixes
Shreshth-Malik Feb 20, 2025
e67a95e
Merge branch 'v.build-test' of https://github.com/Shreshth-Malik/gras…
Shreshth-Malik Feb 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions vector/v.build/testsuite/test_v_build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
import grass.script as gs
from grass.gunittest.case import TestCase
from grass.gunittest.main import test


class TestVBuild(TestCase):
"""Test v.build output against expected output stored in vbuild_output"""

@classmethod
def setUpClass(cls):
"""Set up a temporary region and create vector map with test features."""
cls.use_temp_region()
input_data = "P 1\n1 1\nL 2\n0.5 0.5\n2.5 2.5"
gs.write_command(
"v.in.ascii",
input="-",
format="standard",
stdin=input_data,
output="test_3x3_map",
flags="n",
overwrite=True,
)

# Run v.build (with multiple dump options) and store its output in a class variable.
Copy link
Contributor

Choose a reason for hiding this comment

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

Use read_command, the output is not meant to be parsed into a dictionary.

cls.build_module = gs.read_command(
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be executed in the test_vbuild_output

"v.build",
map="test_3x3_map",
option="build,dump,sdump,cdump,fdump",
quiet=True,
).strip()

# Read the expected output.
cls.vbuild_output = """
N,S,E,W,T,B: 2.500000, 0.500000, 2.500000, 0.500000, 0.000000, 0.000000
-----------------------------------
Nodes (2 nodes, alive + dead):
node = 1, n_lines = 1, xyz = 0.500000, 0.500000, 0.000000
line = 2, type = 2, angle = 0.785398 (45.0000)
node = 2, n_lines = 1, xyz = 2.500000, 2.500000, 0.000000
line = -2, type = 2, angle = -2.356194 (225.0000)
-----------------------------------
Lines (2 lines, alive + dead):
line = 1, type = 1, offset = 18
line = 2, type = 2, offset = 35, n1 = 1, n2 = 2
-----------------------------------
Areas (0 areas, alive + dead):
-----------------------------------
Islands (0 islands, alive + dead):
---------- SPATIAL INDEX DUMP ----------
Nodes
Node level=0 count=2
Branch 0 id = 1 0.500000 0.500000 0.000000 0.500000 0.500000 0.000000
Branch 1 id = 2 2.500000 2.500000 0.000000 2.500000 2.500000 0.000000
Lines
Node level=0 count=2
Branch 0 id = 1 1.000000 1.000000 0.000000 1.000000 1.000000 0.000000
Branch 1 id = 2 0.500000 0.500000 0.000000 2.500000 2.500000 0.000000
Areas
Node level=0 count=0
Isles
Node level=0 count=0
---------- CATEGORY INDEX DUMP: Number of layers: 1 --------------------------------------
Layer 0 number of unique cats: 1 number of cats: 2 number of types: 2
------------------------------------------------------------------------------------------
type | count
1 | 1
2 | 1
category | type | line/area
0 | 1 | 1
0 | 2 | 2
------------------------------------------------------------------------------------------"""

@classmethod
def tearDownClass(cls):
"""Remove created vector map and temporary files, then delete the temp region."""
gs.run_command("g.remove", type="vector", flags="f", name="test_3x3_map")
cls.del_temp_region()

def test_vbuild_output(self):
"""Compare the v.build output (build_module) to the expected output."""
self.assertMultiLineEqual(self.build_module[135:], self.vbuild_output)


if __name__ == "__main__":
test()
Loading