hermes - ✅(Solved) Fix Bug: tests/integration/test_modal_terminal.py returns booleans so logical failures still pass under pytest [2 pull requests]

Official PRs (…)
ON THIS PAGE

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

tests/integration/test_modal_terminal.py defines pytest-style test_* functions, but each test returns True/False instead of asserting.

Pytest treats non-None returns as warnings (PytestReturnNotNoneWarning), not failures, so logically failing checks can still show up as passing tests.

Root Cause

tests/integration/test_modal_terminal.py defines pytest-style test_* functions, but each test returns True/False instead of asserting.

Pytest treats non-None returns as warnings (PytestReturnNotNoneWarning), not failures, so logically failing checks can still show up as passing tests.

Fix Action

Fixed

PR fix notes

PR #13318: fix(tests): make test_modal_terminal actually assert, not return booleans

Description (problem / solution / changelog)

Summary

Closes #13286.

Six of the tests in tests/integration/test_modal_terminal.py used:

success = <condition>
...
return success

Pytest treats a returned value as a warning, not a failure. Every one of these tests has been reported as PASSED regardless of whether Modal actually worked — the file was effectively a no-op under pytest, masking real Modal terminal regressions.

The fix

  • Replace return success / return isolated / return requirements_met with assert <value>, <diagnostic message>. The diagnostic includes exit code and error text so a CI failure is actionable, e.g.:

    assert success, f"Simple command failed: exit={result_json.get('exit_code')}, error={result_json.get('error')}"
  • Replace the TERMINAL_ENV != modal → return False in test_modal_requirements() with pytest.skip(...), which is the correct signal when a precondition isn't met. The test is no longer misreported as PASSED when Modal isn't configured — it's cleanly skipped.

  • Keep the imperative main() runner usable (for the python tests/integration/test_modal_terminal.py usage the module docstring advertises). Rewrote it to tolerate AssertionError / pytest.skip.Exception and classify each test as PASSED / FAILED / SKIPPED in the summary.

Diff

-    if config['env_type'] != 'modal':
-        print(...)
-        return False
+    if config['env_type'] != 'modal':
+        print(...)
+        pytest.skip(f"TERMINAL_ENV='{config['env_type']}', skipping Modal-specific test")
...
-    return success
+    assert success, f"Simple command failed: exit={result_json.get('exit_code')}, error={result_json.get('error')}"

One file changed, +52 / −29 lines.

Verification

  • python3 -m py_compile tests/integration/test_modal_terminal.py → clean.
  • Walked the file top to bottom, confirmed all six test bodies now end with an assert carrying a descriptive message, and that test_modal_requirements() uses pytest.skip() instead of return False when TERMINAL_ENV != "modal".
  • main() still works as a script runner: any pytest.skip.Exception or AssertionError raised by a test function is caught, classified, and reported in the summary — matching the previous script-style behavior as closely as possible while letting pytest do the right thing.

Not in scope

  • #13287 (test_web_tools.py collects 0 tests) — addressed by a different PR / decision about whether to rename or add pytest markers.
  • Reworking these tests into proper @pytest.mark.modal fixtures with conftest auto-skip — would be a larger refactor; this PR intentionally stays minimal and just makes the existing tests actually assert.

Linked Issue

  • Closes #13286

Changed files

  • tests/integration/test_modal_terminal.py (modified, +52/-29)

PR #13325: fix(tests): assert modal terminal integration failures

Description (problem / solution / changelog)

Summary

  • Fixes #13286
  • Converts Modal terminal integration tests from boolean-returning pytest tests to assertion-based tests
  • Keeps the manual script flow available through boolean helper functions and skips cleanly when Modal is not configured

Root Cause

Pytest ignores truthy/falsy return values from test functions, so logical Modal failures could still pass under pytest collection.

Tests

  • uv run --frozen --python 3.11 --extra dev pytest -o addopts='' --collect-only tests/integration/test_modal_terminal.py (6 tests collected)
  • uv run --frozen --python 3.11 --extra dev pytest -o addopts='' tests/integration/test_modal_terminal.py -q (6 skipped, Modal not configured locally)
  • git diff --check -- tests/integration/test_modal_terminal.py

Changed files

  • tests/integration/test_modal_terminal.py (modified, +218/-144)

Code Example

cd /Users/genie/.hermes/hermes-agent
source venv/bin/activate
TERMINAL_ENV=local pytest -q -m integration -o addopts='' tests/integration/test_modal_terminal.py -k test_modal_requirements

---

.                                                                        [100%]
PytestReturnNotNoneWarning: Test functions should return None, but ... returned <class 'bool'>
1 passed, 5 deselected, 1 warning
RAW_BUFFERClick to expand / collapse

Summary

tests/integration/test_modal_terminal.py defines pytest-style test_* functions, but each test returns True/False instead of asserting.

Pytest treats non-None returns as warnings (PytestReturnNotNoneWarning), not failures, so logically failing checks can still show up as passing tests.

Affected file

  • tests/integration/test_modal_terminal.py:58-237

Why this is a bug

This hides Modal/backend regressions while giving a false green signal in CI/manual pytest runs.

Reproduction

cd /Users/genie/.hermes/hermes-agent
source venv/bin/activate
TERMINAL_ENV=local pytest -q -m integration -o addopts='' tests/integration/test_modal_terminal.py -k test_modal_requirements

Observed output:

.                                                                        [100%]
PytestReturnNotNoneWarning: Test functions should return None, but ... returned <class 'bool'>
1 passed, 5 deselected, 1 warning

Inside the test, the current environment clearly does not satisfy the requirement:

  • tests/integration/test_modal_terminal.py:76-79 prints a warning and return False

Expected behavior

A failed requirement check should fail the pytest test.

Actual behavior

The test returns False, pytest emits a warning, and the test still passes.

Suggested investigation direction

Convert these functions to normal pytest assertions (or rename them away from test_* and keep them as manual scripts if that was the intent).

extent analysis

TL;DR

Convert the test functions in tests/integration/test_modal_terminal.py to use pytest assertions instead of returning True/False to fix the issue.

Guidance

  • Replace the return True/return False statements with assert statements to utilize pytest's assertion mechanism.
  • Verify that the tests are failing as expected by checking the output of the pytest command for failed tests instead of just warnings.
  • Consider renaming the test functions if they are not intended to be run as part of the pytest suite, to avoid confusion and unexpected behavior.
  • Review the test functions to ensure they are correctly checking the requirements and failing when necessary.

Example

# Before
def test_modal_requirements():
    # ...
    if not requirement_met:
        print("Warning: requirement not met")
        return False

# After
def test_modal_requirements():
    # ...
    assert requirement_met, "Requirement not met"

Notes

This solution assumes that the test functions are intended to be part of the pytest suite and should be failing when the requirements are not met. If the functions are not intended to be run as tests, renaming them to avoid the test_* prefix may be a better solution.

Recommendation

Apply workaround: Convert the test functions to use pytest assertions to ensure that failing requirement checks result in failed tests. This will provide a more accurate representation of the test results and help catch regressions.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

A failed requirement check should fail the pytest test.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

hermes - ✅(Solved) Fix Bug: tests/integration/test_modal_terminal.py returns booleans so logical failures still pass under pytest [2 pull requests]