intentservice global state (`is_loaded`/`intents_active`) not reset between tests

Open Beginner friendly
#2,124 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
testing-qa

Research direction

Start with tests/langservice/conftest.py::clear_langprovider_state and compare its fixture setup with the intentservice globals is_loaded and intents_active. Run the two pytest command orderings from the issue, then verify the equivalent intentservice state cleanup makes results independent of test order.

Written by the indexing model from the issue text.

Description

bug needs-triage

intentservice.is_loaded/intents_active are module globals and no fixture resets them. Suite runs single-process, so whichever test last called load() decides the next test's state.

Observed while reviewing #1775: test_probe_prompt_translation[probes.tap.TAPIntent] flips result by run order alone:

python -m pytest -p no:cacheprovider   "tests/langservice/probes/test_probes_base.py::test_probe_prompt_translation[probes.tap.TAPIntent]" "tests/probes/test_probes.py::test_probe_metadata[probes.audio.AudioAchillesHeel]"  -v
# SKIPPED

python -m pytest -p no:cacheprovider    "tests/probes/test_probes.py::test_probe_metadata[probes.audio.AudioAchillesHeel]" "tests/langservice/probes/test_probes_base.py::test_probe_prompt_translation[probes.tap.TAPIntent]"  -v
# FAILED: assert 0 == 93 (real bug: TAPIntent.probe() never calls get_text)

Pre-existing, outside #1775's diff

Precedent: langservice has the same issue, already fixed via tests/langservice/conftest.py::clear_langprovider_state. Needs the equivalent for intentservice.

Dominant language
Python
Stars
9.3k
Forks
1.3k
Avg merge
4d 18h
Merged PRs (30d)
12

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from NVIDIA/garak

All issues in NVIDIA/garak

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.