Skip to content

Add tests for source layout inference and import linter contracts with setup.py#1858

Merged
nathanjmcdougall merged 2 commits into
mainfrom
copilot/add-test-source-layout-inference
Apr 7, 2026
Merged

Add tests for source layout inference and import linter contracts with setup.py#1858
nathanjmcdougall merged 2 commits into
mainfrom
copilot/add-test-source-layout-inference

Conversation

Copilot AI commented Apr 7, 2026

Copy link
Copy Markdown
Contributor

setup.py presence in a flat-layout project was untested for both source layout inference and import linter contract generation — a potential regression surface when setup.py exists alongside a real Python package.

Changes

  • test_layout.py — adds test_setup_py_present: asserts get_source_dir_str() returns "." when only setup.py is present (no src/ directory)

  • test_import_linter.py — adds test_flat_layout_with_setup_py to TestGetConfigSpec: creates a flat-layout project with setup.py + a proper package (myflatpkg/ with 3 interdependent modules), then asserts:

    • "setup" is not in the generated contract names (i.e. setup.py is not mistaken for a package)
    • "myflatpkg" is present as a contract
  • .pre-commit-config.yaml / docs/functions.txt / AGENTS.md — fixes a pre-existing check-agent-file-sizes violation (514 lines vs. 500-line limit) by adding --skip-private to the export-functions hook. Private (_-prefixed) functions are implementation details agents shouldn't reference directly; removing them reduces AGENTS.md to 477 lines.

…h setup.py; fix AGENTS.md size limit by skipping private functions in export

Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/2513930c-0ee9-4750-a2de-37bf989b5189

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Copilot AI changed the title [WIP] Add test for source layout inference with setup.py Add tests for source layout inference and import linter contracts with setup.py Apr 7, 2026
Copilot AI requested a review from nathanjmcdougall April 7, 2026 10:36
@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review April 7, 2026 10:45
@codecov

codecov Bot commented Apr 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Apr 7, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing copilot/add-test-source-layout-inference (168e341) with main (cc24d55)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (38f466f) during the generation of this report, so cc24d55 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@nathanjmcdougall nathanjmcdougall merged commit b868419 into main Apr 7, 2026
20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/add-test-source-layout-inference branch April 7, 2026 10:53
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.

Test source layout inference with setup.py

2 participants