Skip to content

Revive the test suite; analyzers folder paths; clear_logs (#7 #12 #15) - #46

Merged
ddehilster merged 1 commit into
VisualText:mainfrom
ddehilster:fix/package-issues
Oct 15, 2026
Merged

ddehilster merged 1 commit into
VisualText:mainfrom
ddehilster:fix/package-issues

Conversation

@ddehilster

Copy link
Copy Markdown
Member

Closes #7, closes #12, closes #15. (#1, the output type through $datum, needs an engine change first and comes separately.)

#7: the test suite runs again.

  • ModuleTest and EngineTest had been @unittest.skip-ed since the v3.1.48 submodule bump (blamed on NLP-ENGINE-521, long since fixed). The email test was commented out. All of them run now.
  • Fixtures regenerated from the current analyzers. I checked each against the old one first:
    • address-parser, links: every extracted value is the same; only the JSON layout changed (flat list, ids from 0).
    • telephone: better. +442012341234 is now a UK international number, where the old fixture had misparsed area 420.
    • emailaddress: better overall (subdomains, country-code TLDs), but two spelled-out addresses lost fields. Filed as emailaddress: spelled-out addresses lost fields analyzers#42. The engine isn't involved: 4.2.18 and 4.2.33 give the same output.
  • Test isolation: test_working_dir, the teardown test and test_json left the module's engine on a temporary folder, so later tests depended on run order.

#12: analyzers folder paths.

  • One Engine.analyzer_dir(name) is now used by analyze, compile, input_text, the kb/user helpers and cloud_compile. Fixes:
    • with an analyzers folder set, compile() returned <folder>/analyzers/<name>, which doesn't exist, so cloud_compile failed with "Analyzer directory not found";
    • a relative analyzers folder broke analyze();
    • Engine(analyzer_path=...) was accepted and ignored.
  • Paths can be str or Path. A relative folder is resolved when it's set.

#15: Engine.clear_logs(name) / NLPPlus.clear_logs(name). Removes the analyzer's output, logs and input/**/*_log folders, and returns how many it removed. Inputs, specs and KB files are left alone.

set_working_folder() now closes the old engine before making the new one. Closing an engine breaks another still open in the process (VisualText/nlp-engine#791, filed with a repro). Left to the garbage collector, that happened at random: the revived suite failed or segfaulted in about half the runs, depending on order. The tests never keep two engines open now.

Tested on Windows against the released NLPPlus 2.2.68 (engine 4.2.33), with this package's Python files copied over it:

  • pytest: 18 passed.
  • unittest in three module orders, 3 runs each: 9/9 green. Before the isolation fixes, json-first failed about half the time.
  • The three new AnalyzerFolderTest tests fail on the old code.
  • flake8 adds no new warnings.

CI runs the suite on Linux only (test.yml). This is the first time EngineTest runs there since the skip, so watch that job.

🤖 Generated with Claude Code

VisualText#12 VisualText#15)

- VisualText#7: ModuleTest and EngineTest had been skipped since the v3.1.48
  submodule bump, the email test commented out. They run again: the
  fixtures are regenerated from the current analyzers (address and links
  differ only in JSON layout; telephone and email changed in the
  analyzers, see VisualText/analyzers#42), and tests no longer leave the
  module's engine pointed at a temporary folder.
- VisualText#12: one analyzer_dir() resolves an analyzer's folder for analyze,
  compile, input_text, the kb/user helpers and cloud_compile. With an
  analyzers folder set, compile() returned <folder>/analyzers/<name>,
  which does not exist, so cloud_compile failed; a relative folder broke
  analyze(). Paths may be str or Path; Engine(analyzer_path=...) is no
  longer ignored.
- VisualText#15: Engine.clear_logs() / NLPPlus.clear_logs() remove an analyzer's
  output, logs and input/*_log folders.
- set_working_folder() closes the old engine before making the new one:
  closing an engine breaks another still open (nlp-engine#791), and left
  to the garbage collector that happened at random.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ddehilster
ddehilster merged commit 59ebe16 into VisualText:main Oct 15, 2026
8 checks passed
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.

Add a clear analyzer logs Fix up path stuff for the analyzer path Fix the email parser test that is broken

1 participant