A Project Someone Else Can Run · practice
Keep One Import Root
Keep the project shape boring. api_catalog.py stays at the project root, tests stay in tests/test_api_catalog.py, and commands start from that root. Do not add src/, package metadata, editable installs, console scripts, or sys.path changes: those would create a new packaging lesson and break reviewed callers.
Create tests/test_api_catalog.py. Use import api_catalog, then test through its public tmp_path test for output bytes and sentinel behavior.
Run tests from the root:
python -m pytest -q
If Python cannot import api_catalog, check the current directory and return to the folder containing both api_catalog.py and tests/. Do not repair the problem with a path mutation.
What should a test module use?
Task
Create tests/test_api_catalog.py with api_catalog as its only project import, plus the standard-library and pytest helpers needed for fake sessions, responses, and tmp_path. Preserve Chapter 11 behavior without live HTTP, path manipulation, import side effects, or generated project-root output.