Skip to content

Tweaks to how wn is used#1316

Merged
erickgalinkin merged 1 commit intoNVIDIA:mainfrom
06kellyjac:test_probes_topic_wn
Aug 4, 2025
Merged

Tweaks to how wn is used#1316
erickgalinkin merged 1 commit intoNVIDIA:mainfrom
06kellyjac:test_probes_topic_wn

Conversation

@06kellyjac
Copy link
Contributor

  • Trigger wn config overrides from WordnetBlockedWords before using wn in tests
    • Running wn.Download() before changing the config location just ends up causing problems and dowloading it again for the new location.
  • Use lang and pass it through to wn.Wordnet in WordnetBlockedWords

An alternative may be to move the wn.config changes to the root of garak/probes/topic.py so it always happens when it's imported.
This was a problem for me with NixOS/nixpkgs#429835 since nix builds don't have internet access. I was trying to allow for enabling these tests, I found out how to load lexicons from pre-fetched files (goodmami/wn#278) but garak tests weren't fully finding it.

If I loaded them to the default location the initial setup for the test worked but then garak couldn't find the lexicon when actually running. If I loaded them to the garak changed location the test wouldn't start at all. If I loaded them to both locations, default first, then garak, it'd still have problems.
After loading it to the location garak usually expects & adding this to the test it works completely fine:

tests/probes/test_probes_topic.py ................                       [ 39%]

For the lang change if it's not intended to be sent to wn.Wordnet it's not immediately obvious to me what it is actually for.

… `wn` in tests

Running `wn.Download()` before changing the config location just ends up
causing problems and dowloading it again for the new location.
@06kellyjac

This comment was marked as resolved.

@06kellyjac 06kellyjac force-pushed the test_probes_topic_wn branch from f03b008 to 79400c3 Compare August 1, 2025 17:00
Copy link
Collaborator

@erickgalinkin erickgalinkin left a comment

Choose a reason for hiding this comment

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

LGTM

@erickgalinkin erickgalinkin merged commit 8ea10cf into NVIDIA:main Aug 4, 2025
15 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 4, 2025
@06kellyjac 06kellyjac deleted the test_probes_topic_wn branch August 4, 2025 17:10
@jmartin-tech jmartin-tech added the tests Testing-related label Aug 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

tests Testing-related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants