Skip to content

Commit cd57647

Browse files
Darshan M Uclaude
andcommitted
Use a stand-in helper script in the analysis-scope test
The wheel jobs run the tests from a copy outside the repo, where tests/../codewiki/templates/... does not exist (FileNotFoundError on Linux and Windows). The test is about which paths are skipped, so it now writes a small script under the helper's name instead of copying it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CXRqeijND7XPq2srGHndRd
1 parent b32bb6d commit cd57647

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

‎tests/test_updater_graph_store.py‎

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ def test_prune_keeps_current_and_prev_only(tmp_path):
7070

7171
def test_codewikis_own_output_is_not_analysed_as_repo_code(tmp_path):
7272
"""A second run used to add the copied helper script (~17 functions) to the user's code."""
73-
import shutil
7473

7574
from codewiki.src.be.dependency_analyzer import DependencyGraphBuilder
7675
from codewiki.src.config import MODULE_TREE_OWNERSHIP_VALIDATOR, Config
@@ -94,16 +93,10 @@ def analysed_files(repo, docs_dir):
9493
(repo / "pkg").mkdir(parents=True)
9594
(repo / "pkg" / "a.py").write_text("def f():\n return 1\n")
9695
(repo / "docs" / "temp").mkdir(parents=True)
97-
script = os.path.join(
98-
os.path.dirname(__file__),
99-
"..",
100-
"codewiki",
101-
"templates",
102-
"docs",
103-
MODULE_TREE_OWNERSHIP_VALIDATOR,
104-
)
105-
shutil.copy(script, repo / "docs" / MODULE_TREE_OWNERSHIP_VALIDATOR) # as `generate` does
106-
shutil.copy(script, repo / "pkg" / MODULE_TREE_OWNERSHIP_VALIDATOR) # a real source copy
96+
# A stand-in with the helper's name: the tests may run from a copy outside the repo.
97+
script = "def check_tree(tree):\n return tree\n\n\ndef main():\n return check_tree({})\n"
98+
(repo / "docs" / MODULE_TREE_OWNERSHIP_VALIDATOR).write_text(script) # as `generate` copies it
99+
(repo / "pkg" / MODULE_TREE_OWNERSHIP_VALIDATOR).write_text(script) # a real source copy
107100
(repo / "docs" / "temp" / "cache.py").write_text("def cached():\n return 1\n")
108101
(repo / "docs" / "conf.py").write_text("def setup(app):\n return app\n") # the user's own
109102

0 commit comments

Comments
 (0)