Repository navigation
Reorganize tests into unit, integration, and support modules - #41
Merged
Merged
Conversation
… none tests/test_code_node.py (1,341 lines, 55 tests) is now one file per part: tests/unit/ (project, reader, graph, platforms, libraries, deploys, report, picker, history) and tests/integration/ (cli, serve, examples), with what they share in tests/support.py. conftest.py marks each test by its folder, so `pytest -m unit` and `-m integration` run one kind (make test-unit, make test-integration, and the same in makefile.py). New tests (24): - imports inside a function: followed, startup=False, scoped to that function; optional imports, relative and star imports - partial maps instead of tracebacks: a bad entry, a file that doesn't parse, a reader that raises - entry_file, entries_in_file, functions_matching, project_root - the deploy helpers: allowed, statement_actions, resolve_handler, load_yaml with CloudFormation tags, line_of - the code read is never run, through main() and python -m code_node - the command as its own process: -o, the cache folder, --help, bad args - --list, a missing folder, an entry point that matches no file - every entry point of each example read to the end; each example's page balanced HTML with nothing fetched from elsewhere; the CI smoke lines - --serve's /events stream over a real connection, through a broken edit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0135RUJGyhafwLiULmpTn7G4
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.
Restructure the test suite to improve organization and maintainability by separating concerns into distinct test categories.
Summary
The monolithic
tests/test_code_node.py(1341 lines) has been split into focused test modules organized by category:tests/unit/) - test individual components in isolationtests/integration/) - test end-to-end workflowstests/support.py) - common test data and utilitiesKey Changes
Test Organization:
tests/test_code_node.py(1341 lines)tests/unit/test_reader.py- code mapping and entry point discoverytests/unit/test_platforms.py- Lambda, web frameworks, and platform pluginstests/unit/test_project.py- folder reading, module names, entry pointstests/unit/test_libraries.py- library plugins and their clientstests/unit/test_deploys.py- SAM and serverless.yml deploy filestests/unit/test_graph.py- graph generation and limitstests/unit/test_report.py- page rendering, code panels, step-by-step walktests/unit/test_history.py- git blame integrationtests/unit/test_picker.py- interactive file/entry point pickertests/integration/test_cli.py- command-line interface end-to-endtests/integration/test_serve.py- live server with hot reloadtests/integration/test_examples.py- example projects against snapshotsShared Test Utilities:
tests/support.pywith:write()helper for creating test projectsHANDLER- Lambda handler examplePACKAGE- console script package exampleSTORES- multi-library exampleFAN- complex call graph exampleIMPORTED_FROM_SRC- local import exampleEXAMPLESandSNAPSHOTSpathsConfiguration:
tests/conftest.pywith pytest markers (unit,integration)pyproject.toml:pythonpath = ["tests"]forsupport.pyimports--strict-markersto pytest optionsunitandintegrationmarkersMakefileandmakefile.pywithtest-unitandtest-integrationtargetsCLAUDE.mdwith new test organization guidanceBenefits
pytest -m unitfor quick validation without I/Osupport.pyeliminates copy-pastehttps://claude.ai/code/session_0135RUJGyhafwLiULmpTn7G4