mirror of
https://github.com/safishamsi/graphify.git
synced 2026-10-15 08:29:26 +00:00
fix(extract): keep cross-drive diagnostic paths from aborting extraction
Assisted-by: OpenAI Codex (GPT-6)
This commit is contained in:
1 parent
35adf432b9
commit
8a98287926
2 files changed
+24
-1
No files matched your search
+5
-1
@@ -7790,7 +7790,11 @@ def extract(
|
||||
continue # empty / whitespace-only: nothing to model, no signal
|
||||
except OSError:
|
||||
_size = 0
|
||||
_symbolless_files.append((os.path.relpath(str(_p), str(root)).replace("\\", "/"), _size))
|
||||
try:
|
||||
_display_path = os.path.relpath(str(_p), str(root)).replace("\\", "/")
|
||||
except ValueError:
|
||||
_display_path = _p.as_posix()
|
||||
_symbolless_files.append((_display_path, _size))
|
||||
if _symbolless_files:
|
||||
_total_bytes = sum(size for _, size in _symbolless_files)
|
||||
_total_mb = _total_bytes / (1024 * 1024)
|
||||
|
||||
@@ -102,6 +102,25 @@ def test_symbolless_warning_names_the_file(tmp_path, capsys):
|
||||
assert "may be data rather than code" not in err
|
||||
|
||||
|
||||
def test_symbolless_warning_survives_a_cross_drive_path(tmp_path, capsys, monkeypatch):
|
||||
import graphify.extract as ex
|
||||
|
||||
source = _data_only_fixture(tmp_path)
|
||||
original_relpath = ex.os.path.relpath
|
||||
|
||||
def cross_drive_relpath(path, start=None):
|
||||
if str(path) == str(source) and str(start) == str(tmp_path):
|
||||
raise ValueError("path is on mount 'D:', start on mount 'C:'")
|
||||
return original_relpath(path, start)
|
||||
|
||||
monkeypatch.setattr(ex.os.path, "relpath", cross_drive_relpath)
|
||||
result = extract([source], root=tmp_path)
|
||||
assert any(node.get("label") == "data.js" for node in result["nodes"])
|
||||
err = capsys.readouterr().err
|
||||
assert "yielded no symbols" in err
|
||||
assert source.as_posix() in err
|
||||
|
||||
|
||||
def test_symbolless_warning_is_silent_for_an_empty_init(tmp_path, capsys):
|
||||
"""An empty __init__.py is symbol-less *code*, ubiquitous in Python
|
||||
packages. It has nothing to model, so the warning must stay silent rather
|
||||
|
||||
Reference in new issue
Block a user