Repository navigation
Conversation
test_ghtml2man.py is a grass.gunittest.case.TestCase test that only parses the already-installed HTML manual pages, so it does not need an active GRASS session or the North Carolina sample dataset like most other testsuite files. Add it to the pytest allowlist and exclude it from the grass.gunittest runner, following the pattern used for the other tests already running under pytest. It reads the GISBASE environment variable, which the pytest.yml and macos.yml gunittest steps did not export before this change (osgeo4w.yml already exports it via env.bat), so export it there too. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0169cUQFskpDPA7wVJ7paGVG
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds
utils/g.html2man/testsuite/test_ghtml2man.pyto the set ofgrass.gunittest-basedtestsuite/tests that already run directly under pytest (.github/workflows/pytest_args_gunittest.txt), and excludes it from thegrass.gunittestrunner (.gunittest.cfg) to avoid running it twice, following the pattern from OSGeo#5584 and OSGeo#6523.The test only parses the already-installed HTML manual pages (
self.gisbase/docs/html/*.html) and doesn't need an active GRASS session or the North Carolina sample dataset. It does read theGISBASEenvironment variable, which thepytest.ymlandmacos.yml"gunittest-based tests" steps didn't export before this change (osgeo4w.ymlalready exports it viaenv.bat), so this PR exports it there too.Motivation and context
I was asked to look at how
grass.gunittesttestsuite tests became runnable under pytest in CI, then find and try other candidate testsuite files that could run under pytest the same way without needing a rewrite (i.e. without needing an active session or the NC sample dataset). I researched this with an AI assistant (Claude), including verifying every candidate against an actual from-source build rather than relying on static reading alone.I looked at roughly 20 files that looked promising from static analysis (no
assertModule/runModule/run_command-style calls visible in the test file itself). Most turned out not to work when actually run:python/grass/pygrass/vector/testsuite/test_table.py: looked self-contained (own temp sqlite3 db), but itstearDowncallsTable.drop(), which internally callsdb_table_in_vector()→g.list, which needs an active GRASS session. Fails withERROR: No active GRASS session: GISRC environment variable not set.python/grass/pygrass/modules/testsuite/test_import_isolation.py: passes on its own, but fails when run in the same pytest process as the other allowlisted files, because they importgrass.lib.*(ctypes bindings) first and this test's whole point is asserting nothing has imported those yet.*_doctests.pyfiles built ondoctest.DocTestSuite(...)inside a module-levelload_tests(loader, tests, ignore)function (test_gunitest_doctests.py,test_pygrass_modules_interface_doctests.py,test_pygrass_shell_doctests.py,test_pygrass_messages_doctests.py): pytest's_pytest/unittest.pycollector only discovers actualunittest.TestCasesubclasses defined in a module; it never calls theload_testsprotocol hook that onlyunittest.TestLoader.loadTestsFromModule()/discover()invoke. So these files collect 0 items under pytest regardless of what they test, confirmed withpytest --collect-onlyvspython -m unittest. I had hoped to split the session-dependent doctests (e.g.grass.pygrass.modules.interface.module,grass.gunittest.gmodules) out into new files so the remaining pure-logic doctests (e.g.grass.pygrass.shell.conversion,grass.gunittest.checkers) could be added to the allowlist, but this collection limitation means splitting wouldn't help; it would need restructuring away fromload_testsentirely, which felt out of scope here.Only
test_ghtml2man.pysurvived, so that's the only test added in this PR.How has this been tested?
Built GRASS locally from source (CMake, Ubuntu 24.04 packages matching
.github/workflows/apt.txtminus PDAL,WITH_GUI=OFF,WITH_DOCS=ONto get the real per-tooldocs/html/*.htmlfiles this test reads) and ran, matching the CI step's env and args:Result:
95 passed, 2 xfailed(previously94 passed, 2 xfailed), withtest_ghtml2man.pypassing against the 550 real installed doc pages.Types of changes
Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_0169cUQFskpDPA7wVJ7paGVG
Generated by Claude Code