test: add pytest test suite and CI workflow#14
Closed
joshbouncesecurity wants to merge 13 commits intoknostic:masterfrom
Closed
test: add pytest test suite and CI workflow#14joshbouncesecurity wants to merge 13 commits intoknostic:masterfrom
joshbouncesecurity wants to merge 13 commits intoknostic:masterfrom
Conversation
Tests cover: - TokenTracker: pricing, cumulative tracking, reset, summaries - Parser adapter: language detection (Python/JS/mixed), venv/node_modules exclusion - Python parser phases: scanner, function extractor, call graph builder, unit generator - JS parser: scanner, TypeScript analyzer, unit generator, full pipeline - Go CLI wrapper: version, help, parse commands, API key handling Includes sample fixtures for Python and JavaScript repos. Known xfails on Windows: - ts-morph backslash path resolution in TypeScript analyzer - Unicode checkmarks in JS test_pipeline.py on cp1252 encoding Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Three jobs: - python-tests: pytest suite (parsers + token tracker) on all 3 OSes - go-build: go vet + go build on all 3 OSes - go-cli-integration: Go CLI integration tests (depends on go-build) Runs on push to master and on pull requests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Will revert to master-only before merging. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Remove needs dependency so go-cli-integration runs in parallel - Add FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 to suppress deprecation warnings - Add cache-dependency-path for Go module cache - Revert trigger to master-only Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- checkout@v4 → v5, setup-node@v4 → v5 (both support Node.js 24) - node-version 20 → 22 - Remove FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 env var Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Avoids duplicate checkout/setup. Also re-add FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 since setup-python@v5 and setup-go@v5 don't have Node.js 24 releases yet. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Add pytest test suite for parsers and core utilities Tests cover: - TokenTracker: pricing, cumulative tracking, reset, summaries - Parser adapter: language detection (Python/JS/mixed), venv/node_modules exclusion - Python parser phases: scanner, function extractor, call graph builder, unit generator - JS parser: scanner, TypeScript analyzer, unit generator, full pipeline - Go CLI wrapper: version, help, parse commands, API key handling Includes sample fixtures for Python and JavaScript repos. Known xfails on Windows: - ts-morph backslash path resolution in TypeScript analyzer - Unicode checkmarks in JS test_pipeline.py on cp1252 encoding Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Add CI workflow to run tests on Linux, macOS, and Windows Three jobs: - python-tests: pytest suite (parsers + token tracker) on all 3 OSes - go-build: go vet + go build on all 3 OSes - go-cli-integration: Go CLI integration tests (depends on go-build) Runs on push to master and on pull requests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci: temporarily trigger on add-test-suite branch for testing Will revert to master-only before merging. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci: fix warnings and run all jobs in parallel - Remove needs dependency so go-cli-integration runs in parallel - Add FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 to suppress deprecation warnings - Add cache-dependency-path for Go module cache - Revert trigger to master-only Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci: use latest action versions instead of Node.js 24 env workaround - checkout@v4 → v5, setup-node@v4 → v5 (both support Node.js 24) - node-version 20 → 22 - Remove FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 env var Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci: merge go-build and go-cli-integration into single job Avoids duplicate checkout/setup. Also re-add FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 since setup-python@v5 and setup-go@v5 don't have Node.js 24 releases yet. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * ci: remove temporary branch trigger Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: support local Claude Code session for LLM calls Add OPENANT_LOCAL_CLAUDE mode that calls the claude CLI in print mode instead of the Anthropic API directly. Uses the local Claude Code session's authentication, so no API key is needed. Changes: - Add utilities/local_claude.py with LocalClaudeClient, a drop-in replacement for anthropic.Anthropic() that routes through `claude -p` - Add create_anthropic_client() factory that returns the right client based on OPENANT_LOCAL_CLAUDE env var - Update all direct anthropic.Anthropic() callsites to use the factory (agentic_enhancer, finding_verifier, application_context, report generators) - Skip API key requirement in Go CLI when OPENANT_LOCAL_CLAUDE=true - Add LOCAL_CLAUDE.md with setup and usage instructions - Token usage and cost tracking works in both modes (CLI JSON output includes usage data) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * chore: remove LOCAL_CLAUDE.md from tracking Keep as local-only documentation, not part of the codebase. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Use platform-aware binary name (openant.exe on Windows, openant elsewhere) - Split CI build step per OS to produce correct binary name - Add verification step to catch missing binary Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Pre-existing issue: test_pipeline.py uses Unicode checkmarks that crash on Windows cp1252 encoding. Will be fixed in a separate PR. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Keep our fixes: platform-aware binary name, Unicode skip, CI improvements. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
|
Closing — branch had unrelated commits mixed in. Reopening as a clean PR. |
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.
Closes #13
Summary
Tests (60 total)
test_token_tracker.pytest_parser_adapter.pytest_python_parser.pytest_js_parser.pytest_go_cli.pyCI workflow
Two jobs, each running on ubuntu/macos/windows (6 total):
go vet+go build+ Go CLI integration testsTriggers on push to master and on pull requests.
Known xfails on Windows
test_pipeline.pyon cp1252 encodingThese are pre-existing issues, not introduced by this PR.
Test plan
🤖 Generated with Claude Code