Skip to content

fix(client): handle silent-skip anti-pattern in test_gremlin.py#336

Merged
imbajin merged 7 commits into
apache:mainfrom
Muawiya-contact:fix/silent-skip-gremlin-setUpClass
May 21, 2026
Merged

fix(client): handle silent-skip anti-pattern in test_gremlin.py#336
imbajin merged 7 commits into
apache:mainfrom
Muawiya-contact:fix/silent-skip-gremlin-setUpClass

Conversation

@Muawiya-contact
Copy link
Copy Markdown
Contributor

What this PR does

Fixes the silent-skip anti-pattern in test_gremlin.py — previously, if the Gremlin endpoint was down, all 6 tests would silently show as SKIPPED in CI instead of FAILED, hiding real regressions.

Fixes #327 · Related: #325, #320


The problem

# OLD — bad
except (ConnectionError, Timeout, HTTPError):
    raise unittest.SkipTest("Gremlin endpoint unavailable")  # hides failures!

Any connectivity issue would silently swallow failures and mark tests as skipped. A broken endpoint would look green in CI. Not good.


The fix

  • Removed the automatic connectivity probe from setUpClass
  • Failures now surface as FAILED, not SKIPPED
  • Added an explicit opt-in skip via env var for local dev:
# want to skip? opt in explicitly
export SKIP_GREMLIN_TESTS=true

Running locally

# start HugeGraph
docker run -d --name hugegraph -p 8080:8080 hugegraph/hugegraph:latest

wait ~30s, then run

python -m pytest src/tests/api/test_gremlin.py -v

cleanup

docker stop hugegraph && docker rm hugegraph


Test results

Scenario Expected
No endpoint FAILED
SKIP_GREMLIN_TESTS=true SKIPPED
Env var unset FAILED
TestGremlinSetupBehavior unit tests PASSED

Files changed

Only one file touched: hugegraph-python-client/src/tests/api/test_gremlin.py

…setUpClass

- Remove automatic connectivity probe that silently skipped all 6 Gremlin integration tests on 404 / timeout / connection error
- Endpoint failures now surface as FAILED, not SKIPPED
- Add explicit opt-in skip via SKIP_GREMLIN_TESTS env variable
- Document Docker-based local setup in inline comments

Fixes apache#327
Related: apache#325, apache#320

Signed-off-by: Muawiya-contact <contactmuawia@gmail.com>
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label May 18, 2026
@Muawiya-contact
Copy link
Copy Markdown
Contributor Author

Hey @imbajin 👋

PR #336 is up for #327 — one file changed, small and focused.

Quick recap of what's in it:

  • Removed the silent-skip probe from setUpClass
  • Tests now FAIL (not skip) when the endpoint is down
  • Added explicit SKIP_GREMLIN_TESTS=true opt-in as you suggested
  • Documented Docker local setup in inline comments

Ready for your review whenever you get a chance! 🙏

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes the silent-skip connectivity probe from TestGremlin.setUpClass so that Gremlin endpoint failures surface as test failures rather than skipped tests. An explicit opt-in skip mechanism is added via the SKIP_GREMLIN_TESTS environment variable, and the accompanying unit tests in TestGremlinSetupBehavior are updated to reflect the new behavior.

Changes:

  • Drop the try/except NotFoundError probe that auto-skipped all Gremlin tests when the endpoint was unreachable.
  • Add SKIP_GREMLIN_TESTS=true env-var opt-in path that raises unittest.SkipTest.
  • Rewrite/extend behavior tests: rename the old "skips on 404" test to "reraises probe errors" and add a new test for the env-var skip path.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread hugegraph-python-client/src/tests/api/test_gremlin.py Outdated
Comment thread hugegraph-python-client/src/tests/api/test_gremlin.py Outdated
@Muawiya-contact
Copy link
Copy Markdown
Contributor Author

@imbajin can you review that one, please?

@imbajin imbajin changed the title test(python-client): fix silent-skip anti-pattern in test_gremlin.py setUpClass (#327) fix(client): handle silent-skip anti-pattern in test_gremlin.py May 21, 2026
Copy link
Copy Markdown
Member

@imbajin imbajin left a comment

Choose a reason for hiding this comment

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

One non-blocking maintainability suggestion from the follow-up review.

Comment thread hugegraph-python-client/src/tests/api/test_gremlin.py
@Muawiya-contact
Copy link
Copy Markdown
Contributor Author

Muawiya-contact commented May 21, 2026

@imbajin
Done ✅. I have removed that skip_gremlin_tests.

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 21, 2026
@imbajin imbajin merged commit efc9008 into apache:main May 21, 2026
13 checks passed
@Muawiya-contact
Copy link
Copy Markdown
Contributor Author

@imbajin Thanks, currently I'm focusing on #326, besides this any other fixes for me? I'm now exploring the code base and experices that, as an AI student -- want to dive more.

@imbajin
Copy link
Copy Markdown
Member

imbajin commented May 21, 2026

@imbajin Thanks, currently I'm focusing on #326, besides this any other fixes for me? I'm now exploring the code base and experices that, as an AI student -- want to dive more.

maybe we could add some skills for hugegraph & graphrag/text2gremlin?

or set a goal for:

  • tests enhancement
  • code clean/simplify?
  • auto-find some tasks

@Muawiya-contact
Copy link
Copy Markdown
Contributor Author

Thanks @imbajin!
Really excited about the GraphRAG/text2gremlin direction — that's exactly where my AI interests lie. I'll finish #326 first, then explore what's already in the codebase for text2gremlin and see where I can add value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer python-client size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] test: fix silent skip anti-pattern in test_gremlin.py setUpClass probe

3 participants