Repository navigation
test: enable mypy typing checks for the whole test folder - #12930
Merged
bogdankostic merged 2 commits intoSep 25, 2026
Merged
bogdankostic merged 2 commits into
bogdankostic merged 2 commits into
Conversation
Replace the hand-maintained path list in the `types` target with
`{args:haystack test}`. The only tracked files the list still skipped were
`test/conftest.py` and three license-header-only `__init__.py` files.
Fix the 3 errors in `conftest.py`:
- annotate `request_blocker`'s `monkeypatch` parameter and return type
- drop `tracer.is_content_tracing_enabled = True` from `spying_tracer`: the
flag lives on the global `ProxyTracer`, not on `SpyingTracer`, and
`SpyingSpan.set_content_tag` records unconditionally, so the assignment
never had an effect
Part of #10396.
ShousenZHANG
requested review from
bogdankostic
and removed request for
a team
September 24, 2026 14:55
Contributor
|
@ShousenZHANG is attempting to deploy a commit to the deepset Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
bogdankostic
approved these changes
Sep 25, 2026
bogdankostic
left a comment
Contributor
There was a problem hiding this comment.
Looks good, thanks @ShousenZHANG!
27 of 38 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
typeschecks every tracked.pyfile undertest/test_agent.py)Proposed Changes:
Replaces the hand-maintained path list in the
typestarget with{args:haystack test}and drops the# TODO We want to eventually type the whole test folder. All the old list still skipped wastest/conftest.pyplustest/__init__.py,test/components/agents/__init__.pyandtest/hooks/__init__.py, which contain only the license header. The unchecked directories in the #10396 list (classifiers/,connectors/,readers/,tools/,websearch/) no longer exist onmain.Baseline on those four files was 3 errors, all in
conftest.py. No suppressions.no-untyped-defonrequest_blocker:monkeypatch: pytest.MonkeyPatchand-> None, next to therequest: pytest.FixtureRequestit already had.attr-defined.spying_tracerdidtracer.is_content_tracing_enabled = Trueon aSpyingTracer. That flag is an attribute of the globalProxyTracer(haystack/tracing/tracer.py:118), which is where the baseSpan.set_content_tagreads it (:65), so setting it on the spying instance never reached anything — andSpyingSpan.set_content_tag(test/tracing/utils.py:31) overrides that method and records unconditionally anyway. The line is removed rather than pointed at the global tracer: that would flip a process-wide flag for every test using the fixture, whichtest/core/pipeline/test_tracing.pyalready does where it needs to, scoped throughmonkeypatch.How did you test it?
mypyon the four files -> 3 errors. After:hatch run test:typeschecks 550 source files (546 before), with only the pre-existing error below.pytestontest/tracing,test/core/pipeline/test_tracing.pyand the three modules that usespying_tracer(test_agent.py,test_llm_evaluator.py,test_llm_document_content_extractor.py) -> 237 passed. Full unit suite -> 6497 passed, 47 skipped.hatch run fmt-check-> clean, 7139 files.maincheckout:test_openai_responses_conversion.py:1017(localopenai3.3.1 predates thenamefield onResponseFunctionCallArgumentsDoneEvent; CI resolves a newer one) and thespam.csvcase oftest_from_file_path_guess_mime_type(Windows mime registry). Neither is touched by this change.No release note: test and dev-tooling config only, which AGENTS.md excludes from the release-note requirement.
This PR was written with AI assistance.