Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 17, 2026

Manual clear_base_renderer_cache() and clear_function_apis_registry() calls scattered across test files to prevent cross-test pollution. Consolidates these into a single autouse fixture.

Changes

  • conftest.py: Added reset_state() fixture with autouse=True that executes both clear functions before each test
  • test_symbol_exposure.py: Removed manual clear calls (now handled by fixture)
  • test_cli.py: Removed manual clear calls from 10 test functions

Impact

All 15 test files in numbast/src/numbast/tools/tests/ now automatically reset state before each test. Single point of maintenance for state reset logic.

@pytest.fixture(autouse=True)
def reset_state():
    """Reset global state before each test to avoid cross-test pollution."""
    clear_base_renderer_cache()
    clear_function_apis_registry()
    yield
Original prompt

This section details on the original issue you should resolve

<issue_title>Refactor state reset calls into a shared pytest fixture</issue_title>
<issue_description>## Description

In numbast/src/numbast/tools/tests/test_symbol_exposure.py, the test manually calls clear_base_renderer_cache() and clear_function_apis_registry() at the start to avoid cross-test pollution.

Proposed Change

Refactor these calls into a shared pytest fixture (optionally with autouse=True) that can be:

  • Placed in the test module or a conftest.py
  • Automatically run before each test to guarantee state reset
  • Centralized for reuse across multiple tests if needed

Context

Implementation Notes

The fixture should:

  1. Import and execute clear_base_renderer_cache() from numbast.static.renderer
  2. Import and execute clear_function_apis_registry() from numbast.static.function
  3. Yield control to allow for future teardown/cleanup logic if needed
  4. Consider using autouse=True to automatically apply to all tests in scope</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@copy-pr-bot
Copy link

copy-pr-bot bot commented Jan 17, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 17, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI and others added 2 commits January 17, 2026 18:32
Co-authored-by: isVoid <13521008+isVoid@users.noreply.github.com>
Co-authored-by: isVoid <13521008+isVoid@users.noreply.github.com>
Copilot AI changed the title [WIP] Refactor state reset calls into shared pytest fixture Refactor state reset calls into shared pytest fixture Jan 17, 2026
Copilot AI requested a review from isVoid January 17, 2026 18:37
@isVoid
Copy link
Collaborator

isVoid commented Jan 20, 2026

/ok to test

@copy-pr-bot
Copy link

copy-pr-bot bot commented Jan 20, 2026

/ok to test

@isVoid, there was an error processing your request: E1

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/1/

@isVoid
Copy link
Collaborator

isVoid commented Jan 20, 2026

/ok to test 760d3fa

@isVoid isVoid marked this pull request as ready for review January 20, 2026 18:40
@isVoid isVoid merged commit b0acc90 into main Jan 21, 2026
26 checks passed
@isVoid isVoid deleted the copilot/refactor-state-reset-fixture branch January 21, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Refactor state reset calls into a shared pytest fixture

1 participant