33import os
44
55from contextlib import contextmanager
6- from pathlib import Path
76from typing import TYPE_CHECKING
87from typing import Any
98from typing import Iterator
10- from typing import cast
119
1210from poetry .console .application import Application
1311from poetry .factory import Factory
1614
1715
1816if TYPE_CHECKING :
17+ from pathlib import Path
18+
1919 from poetry .core .packages .package import Package
2020 from poetry .installation .operations .operation import Operation
2121 from poetry .poetry import Poetry
@@ -33,13 +33,9 @@ def reset_poetry(self) -> None:
3333 self ._poetry = Factory ().create_poetry (poetry .file .path .parent )
3434 self ._poetry .set_pool (poetry .pool )
3535 self ._poetry .set_config (poetry .config )
36- lock = poetry .locker .lock
37- if isinstance (lock , Path ):
38- lock_path = cast ("Path" , lock )
39- else :
40- # poetry < 1.3
41- lock_path = lock .path
42- self ._poetry .set_locker (TestLocker (lock_path , self ._poetry .local_config ))
36+ self ._poetry .set_locker (
37+ TestLocker (poetry .locker .lock , self ._poetry .local_config )
38+ )
4339
4440
4541class TestLocker (Locker ):
@@ -63,7 +59,7 @@ def locked(self, is_locked: bool = True) -> TestLocker:
6359 def mock_lock_data (self , data : dict [str , Any ]) -> None :
6460 self .locked ()
6561
66- self ._lock_data = data # type: ignore[assignment]
62+ self ._lock_data = data
6763
6864 def is_fresh (self ) -> bool :
6965 return True
0 commit comments