@@ -13412,9 +13412,55 @@ add_executable(headerapp include/headers.hpp)
1341213412
1341313413 expect(project.detected.commands.test).toBe("pytest");
1341413414 expect(suite?.ownedFiles).toEqual([{ path: "test_app.py", reason: "pytest file" }]);
13415+ expect(suite?.contextFiles).toEqual([
13416+ { path: "pyproject.toml", reason: "python target runtime metadata" },
13417+ { path: "test_app.py", reason: "nearby test" },
13418+ ]);
13419+ expect(suite?.contextFiles).not.toContainEqual({
13420+ path: ".python-version",
13421+ reason: "python target runtime metadata",
13422+ });
13423+ expect(suite?.contextFiles).not.toContainEqual({
13424+ path: "runtime.txt",
13425+ reason: "python target runtime metadata",
13426+ });
1341513427 expect(suite?.tests).toEqual([{ path: "test_app.py", command: "pytest" }]);
1341613428 });
1341713429
13430+ it("threads Python runtime metadata into standalone pytest suites", async () => {
13431+ const root = await fixtureRoot("clawpatch-python-test-runtime-context-");
13432+ await writeFixture(root, "pyproject.toml", '[project]\nname = "runtime-tests"\n');
13433+ await writeFixture(root, ".python-version", "3.14\n");
13434+ await writeFixture(root, "runtime.txt", "python-3.14\n");
13435+ await writeFixture(
13436+ root,
13437+ "tests/test_pep758.py",
13438+ [
13439+ "def test_pep758_exception_group():",
13440+ " try:",
13441+ " int('x')",
13442+ " except TypeError, ValueError:",
13443+ " assert True",
13444+ "",
13445+ ].join("\n"),
13446+ );
13447+
13448+ const project = await detectProject(root);
13449+ const result = await mapFeatures(root, project, []);
13450+ const suite = result.features.find((feature) => feature.title === "Python test suite tests");
13451+
13452+ expect(suite?.contextFiles).toContainEqual({
13453+ path: ".python-version",
13454+ reason: "python target runtime metadata",
13455+ });
13456+ expect(suite?.contextFiles).toContainEqual({
13457+ path: "runtime.txt",
13458+ reason: "python target runtime metadata",
13459+ });
13460+ expect(suite?.ownedFiles).toEqual([{ path: "tests/test_pep758.py", reason: "pytest file" }]);
13461+ expect(suite?.tests).toEqual([{ path: "tests/test_pep758.py", command: "pytest" }]);
13462+ });
13463+
1341813464 it("maps Flask routes under web source roots", async () => {
1341913465 const root = await fixtureRoot("clawpatch-python-flask-routes-");
1342013466 await writeFixture(root, "requirements.txt", "Flask\npytest\n");
0 commit comments