12
12
13
13
14
14
@pytest .fixture
15
- def mock_codebase_context (tmp_path ):
15
+ def mock_codebase_graph (tmp_path ):
16
16
mock = MagicMock (spec = CodebaseContext )
17
17
mock .transaction_manager = MagicMock ()
18
18
mock .config = CodebaseConfig ()
19
19
mock .repo_path = tmp_path
20
20
mock .to_absolute = types .MethodType (CodebaseContext .to_absolute , mock )
21
21
mock .to_relative = types .MethodType (CodebaseContext .to_relative , mock )
22
+ mock .io = MagicMock ()
22
23
return mock
23
24
24
25
@@ -39,7 +40,7 @@ def sub_dir(subdir_path, tmp_path):
39
40
40
41
@pytest .fixture
41
42
def mock_file (dir_path , mock_codebase_graph ):
42
- return File (filepath = dir_path / "example.py" , G = mock_codebase_graph )
43
+ return File (filepath = dir_path / "example.py" , ctx = mock_codebase_graph )
43
44
44
45
45
46
@pytest .fixture
@@ -67,7 +68,7 @@ def test_name_property(mock_directory):
67
68
68
69
def test_add_and_file (mock_directory , mock_codebase_graph ):
69
70
"""Test adding a file to the directory."""
70
- mock_file = File (filepath = Path ("mock_dir/example_2.py" ), G = mock_codebase_graph )
71
+ mock_file = File (filepath = Path ("mock_dir/example_2.py" ), ctx = mock_codebase_graph )
71
72
mock_directory .add_file (mock_file )
72
73
rel_path = os .path .relpath (mock_file .file_path , mock_directory .dirpath )
73
74
assert rel_path in mock_directory .items
@@ -143,7 +144,7 @@ def test_files_property(mock_directory, sub_dir, mock_codebase_graph):
143
144
all_files = mock_directory .files
144
145
assert len (all_files ) == 1
145
146
146
- new_file = File (filepath = Path ("mock_dir/example_2.py" ), G = mock_codebase_graph )
147
+ new_file = File (filepath = Path ("mock_dir/example_2.py" ), ctx = mock_codebase_graph )
147
148
sub_dir .add_file (new_file )
148
149
149
150
all_files = mock_directory .files
0 commit comments