Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions scripts/update_lib/tests/test_deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,19 @@ def test_syntax_error_returns_empty(self):
class TestGetLibPaths(unittest.TestCase):
"""Tests for get_lib_paths function."""

def test_known_dependency(self):
"""Test library with known dependencies."""
paths = get_lib_paths("datetime", "cpython")
self.assertEqual(len(paths), 2)
self.assertIn(pathlib.Path("cpython/Lib/datetime.py"), paths)
self.assertIn(pathlib.Path("cpython/Lib/_pydatetime.py"), paths)
def test_auto_detect_py_module(self):
"""Test auto-detection of _py{module}.py pattern."""
with tempfile.TemporaryDirectory() as tmpdir:
tmpdir = pathlib.Path(tmpdir)
lib_dir = tmpdir / "Lib"
lib_dir.mkdir()
(lib_dir / "datetime.py").write_text("# datetime")
(lib_dir / "_pydatetime.py").write_text("# _pydatetime")

paths = get_lib_paths("datetime", str(tmpdir))
self.assertEqual(len(paths), 2)
self.assertIn(tmpdir / "Lib" / "datetime.py", paths)
self.assertIn(tmpdir / "Lib" / "_pydatetime.py", paths)
Comment on lines +67 to +79
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Test change violates test-file modification policy

Lines 67-79 introduce new test logic/assertions/data in a *test*.py file, which is disallowed by the repo’s test-file guidelines (only expectedFailure decorator changes are permitted). Please revert this test change or coordinate an exception with maintainers. As per coding guidelines, ...

🤖 Prompt for AI Agents
In `@scripts/update_lib/tests/test_deps.py` around lines 67 - 79, The new
assertions and file creation in test_auto_detect_py_module violate the repo's
policy against adding or changing test logic; revert this test change so the
file only contains allowed edits (e.g., expectedFailure decorators) or
coordinate an exception with maintainers. Specifically, undo the added creation
of (lib_dir / "datetime.py") and (lib_dir / "_pydatetime.py") and the additional
assertions around get_lib_paths("datetime", ...) so test_auto_detect_py_module
returns to its prior state.


def test_default_file(self):
"""Test default to .py file."""
Expand Down
Loading