@@ -40,12 +40,12 @@ class TestRestoreNpmDependenciesAlternativeLockfiles:
4040 ],
4141 )
4242 def test_lockfile_exists_should_skip_npm_install (
43- self ,
44- restore_npm_dependencies : RestoreNpmDependencies ,
45- tmp_path : Path ,
46- lockfile_name : str ,
47- lockfile_content : str ,
48- expected_content : str ,
43+ self ,
44+ restore_npm_dependencies : RestoreNpmDependencies ,
45+ tmp_path : Path ,
46+ lockfile_name : str ,
47+ lockfile_content : str ,
48+ expected_content : str ,
4949 ) -> None :
5050 """Test that when any lockfile exists, npm install is skipped."""
5151 # Setup: Create package.json and lockfile
@@ -70,7 +70,7 @@ def test_lockfile_exists_should_skip_npm_install(
7070 assert result .content == expected_content
7171
7272 def test_no_lockfile_exists_should_proceed_with_normal_flow (
73- self , restore_npm_dependencies : RestoreNpmDependencies , tmp_path : Path
73+ self , restore_npm_dependencies : RestoreNpmDependencies , tmp_path : Path
7474 ) -> None :
7575 """Test that when no lockfile exists, normal flow proceeds (will run npm install)."""
7676 # Setup: Create only package.json (no lockfile)
@@ -85,9 +85,9 @@ def test_no_lockfile_exists_should_proceed_with_normal_flow(
8585
8686 # Mock the base class's try_restore_dependencies to verify it's called
8787 with patch .object (
88- restore_npm_dependencies .__class__ .__bases__ [0 ],
89- 'try_restore_dependencies' ,
90- return_value = None ,
88+ restore_npm_dependencies .__class__ .__bases__ [0 ],
89+ 'try_restore_dependencies' ,
90+ return_value = None ,
9191 ) as mock_super :
9292 # Execute
9393 restore_npm_dependencies .try_restore_dependencies (document )
@@ -104,10 +104,10 @@ class TestRestoreNpmDependenciesPathResolution:
104104 [True , False ],
105105 )
106106 def test_path_resolution_with_different_path_types (
107- self ,
108- restore_npm_dependencies : RestoreNpmDependencies ,
109- tmp_path : Path ,
110- has_absolute_path : bool ,
107+ self ,
108+ restore_npm_dependencies : RestoreNpmDependencies ,
109+ tmp_path : Path ,
110+ has_absolute_path : bool ,
111111 ) -> None :
112112 """Test path resolution with absolute or relative paths."""
113113 package_json_path = tmp_path / 'package.json'
@@ -127,9 +127,7 @@ def test_path_resolution_with_different_path_types(
127127 assert result is not None
128128 assert result .content == 'lockfileVersion: 5.4\n '
129129
130- def test_path_resolution_in_monitor_mode (
131- self , tmp_path : Path
132- ) -> None :
130+ def test_path_resolution_in_monitor_mode (self , tmp_path : Path ) -> None :
133131 """Test path resolution in monitor mode."""
134132 # Setup monitor mode context
135133 ctx = MagicMock (spec = typer .Context )
@@ -160,7 +158,7 @@ def test_path_resolution_in_monitor_mode(
160158 assert result .content == 'lockfileVersion: 5.4\n '
161159
162160 def test_path_resolution_with_nested_directory (
163- self , restore_npm_dependencies : RestoreNpmDependencies , tmp_path : Path
161+ self , restore_npm_dependencies : RestoreNpmDependencies , tmp_path : Path
164162 ) -> None :
165163 """Test path resolution with a nested directory structure."""
166164 subdir = tmp_path / 'src' / 'app'
@@ -188,7 +186,7 @@ class TestRestoreNpmDependenciesEdgeCases:
188186 """Test edge cases and error scenarios."""
189187
190188 def test_empty_lockfile_should_still_be_used (
191- self , restore_npm_dependencies : RestoreNpmDependencies , tmp_path : Path
189+ self , restore_npm_dependencies : RestoreNpmDependencies , tmp_path : Path
192190 ) -> None :
193191 """Test that the empty lockfile is still used (prevents npm install)."""
194192 package_json_path = tmp_path / 'package.json'
@@ -210,7 +208,7 @@ def test_empty_lockfile_should_still_be_used(
210208 assert result .content == ''
211209
212210 def test_multiple_lockfiles_should_use_first_found (
213- self , restore_npm_dependencies : RestoreNpmDependencies , tmp_path : Path
211+ self , restore_npm_dependencies : RestoreNpmDependencies , tmp_path : Path
214212 ) -> None :
215213 """Test that when multiple lockfiles exist, the first one found is used (package-lock.json has priority)."""
216214 package_json_path = tmp_path / 'package.json'
@@ -237,7 +235,7 @@ def test_multiple_lockfiles_should_use_first_found(
237235 assert result .content == '{"lockfileVersion": 2}\n '
238236
239237 def test_multiple_alternative_lockfiles_should_use_first_found (
240- self , restore_npm_dependencies : RestoreNpmDependencies , tmp_path : Path
238+ self , restore_npm_dependencies : RestoreNpmDependencies , tmp_path : Path
241239 ) -> None :
242240 """Test that when multiple alternative lockfiles exist (but no package-lock.json),
243241 the first one found is used."""
@@ -263,7 +261,7 @@ def test_multiple_alternative_lockfiles_should_use_first_found(
263261 assert result .content == '# yarn lockfile\n '
264262
265263 def test_lockfile_in_different_directory_should_not_be_found (
266- self , restore_npm_dependencies : RestoreNpmDependencies , tmp_path : Path
264+ self , restore_npm_dependencies : RestoreNpmDependencies , tmp_path : Path
267265 ) -> None :
268266 """Test that lockfile in a different directory is not found."""
269267 package_json_path = tmp_path / 'package.json'
@@ -282,17 +280,17 @@ def test_lockfile_in_different_directory_should_not_be_found(
282280
283281 # Mock the base class to verify it's called (since lockfile not found)
284282 with patch .object (
285- restore_npm_dependencies .__class__ .__bases__ [0 ],
286- 'try_restore_dependencies' ,
287- return_value = None ,
283+ restore_npm_dependencies .__class__ .__bases__ [0 ],
284+ 'try_restore_dependencies' ,
285+ return_value = None ,
288286 ) as mock_super :
289287 restore_npm_dependencies .try_restore_dependencies (document )
290288
291289 # Should proceed with normal flow since lockfile not in same directory
292290 mock_super .assert_called_once_with (document )
293291
294292 def test_non_json_file_should_not_trigger_restore (
295- self , restore_npm_dependencies : RestoreNpmDependencies , tmp_path : Path
293+ self , restore_npm_dependencies : RestoreNpmDependencies , tmp_path : Path
296294 ) -> None :
297295 """Test that non-JSON files don't trigger restore."""
298296 text_file = tmp_path / 'readme.txt'
@@ -340,9 +338,7 @@ def test_get_lock_file_names(self, restore_npm_dependencies: RestoreNpmDependenc
340338 for alt_lock in ALTERNATIVE_LOCK_FILES :
341339 assert alt_lock in lock_file_names
342340
343- def test_prepare_manifest_file_path_for_command (
344- self , restore_npm_dependencies : RestoreNpmDependencies
345- ) -> None :
341+ def test_prepare_manifest_file_path_for_command (self , restore_npm_dependencies : RestoreNpmDependencies ) -> None :
346342 """Test prepare_manifest_file_path_for_command removes package.json from the path."""
347343 result = restore_npm_dependencies .prepare_manifest_file_path_for_command ('/path/to/package.json' )
348344 assert result == '/path/to'
0 commit comments