16
16
17
17
18
18
@pytest .fixture
19
- def poetry_with_up_to_date_lockfile (
19
+ def poetry_with_outdated_lockfile (
20
20
project_factory : ProjectFactory , fixture_dir : FixtureDirGetter
21
21
) -> Poetry :
22
22
source = fixture_dir ("outdated_lock" )
@@ -37,21 +37,46 @@ def poetry_with_up_to_date_lockfile(
37
37
)
38
38
def test_update_with_dry_run_keep_files_intact (
39
39
command : str ,
40
- poetry_with_up_to_date_lockfile : Poetry ,
40
+ poetry_with_outdated_lockfile : Poetry ,
41
41
repo : TestRepository ,
42
42
command_tester_factory : CommandTesterFactory ,
43
43
) -> None :
44
- tester = command_tester_factory ("update" , poetry = poetry_with_up_to_date_lockfile )
44
+ tester = command_tester_factory ("update" , poetry = poetry_with_outdated_lockfile )
45
45
46
- original_pyproject_content = poetry_with_up_to_date_lockfile .file .read ()
47
- original_lockfile_content = poetry_with_up_to_date_lockfile ._locker .lock_data
46
+ original_pyproject_content = poetry_with_outdated_lockfile .file .read ()
47
+ original_lockfile_content = poetry_with_outdated_lockfile ._locker .lock_data
48
48
49
49
repo .add_package (get_package ("docker" , "4.3.0" ))
50
50
repo .add_package (get_package ("docker" , "4.3.1" ))
51
51
52
52
tester .execute (command )
53
53
54
- assert poetry_with_up_to_date_lockfile .file .read () == original_pyproject_content
55
- assert (
56
- poetry_with_up_to_date_lockfile ._locker .lock_data == original_lockfile_content
57
- )
54
+ assert poetry_with_outdated_lockfile .file .read () == original_pyproject_content
55
+ assert poetry_with_outdated_lockfile ._locker .lock_data == original_lockfile_content
56
+
57
+
58
+ @pytest .mark .parametrize (
59
+ ("command" , "expected" ),
60
+ [
61
+ ("" , True ),
62
+ ("--dry-run" , True ),
63
+ ("--lock" , False ),
64
+ ],
65
+ )
66
+ def test_update_prints_operations (
67
+ command : str ,
68
+ expected : bool ,
69
+ poetry_with_outdated_lockfile : Poetry ,
70
+ repo : TestRepository ,
71
+ command_tester_factory : CommandTesterFactory ,
72
+ ) -> None :
73
+ tester = command_tester_factory ("update" , poetry = poetry_with_outdated_lockfile )
74
+
75
+ repo .add_package (get_package ("docker" , "4.3.0" ))
76
+ repo .add_package (get_package ("docker" , "4.3.1" ))
77
+
78
+ tester .execute (command )
79
+ output = tester .io .fetch_output ()
80
+
81
+ assert ("Package operations:" in output ) is expected
82
+ assert ("Installing docker (4.3.1)" in output ) is expected
0 commit comments