@@ -30,9 +30,9 @@ def test_build_migration_sequence_with_dependencies(mock_get_previous_migration_
30
30
with patch .object (Migration , 'get_migration_files' , return_value = mock_filenames ):
31
31
# Mock the output of get_previous_migration_id
32
32
mock_get_previous_migration_id .side_effect = {
33
- 'migration2.py ' : 'migration1' ,
34
- 'migration3.py ' : 'migration2' ,
35
- 'migration1.py ' : None
33
+ 'migration2' : 'migration1' ,
34
+ 'migration3' : 'migration2' ,
35
+ 'migration1' : None
36
36
}.get
37
37
38
38
# Instantiate YourClass
@@ -51,16 +51,17 @@ def test_build_migration_sequence_with_circular_dependency(mock_get_previous_mig
51
51
with patch .object (Migration , 'get_migration_files' , return_value = mock_filenames ):
52
52
# Mock the output of get_previous_migration_id to create circular dependency
53
53
mock_get_previous_migration_id .side_effect = {
54
- 'migration2.py ' : 'migration1' ,
55
- 'migration1.py ' : 'migration2'
54
+ 'migration2' : 'migration1' ,
55
+ 'migration1' : 'migration2'
56
56
}.get
57
57
58
58
# Instantiate YourClass
59
59
your_instance = Migration ()
60
60
61
- # Call the method to test
62
- with pytest .raises (ValueError ):
61
+ # Call the method to test and assert the raised ValueError with the expected message
62
+ with pytest .raises (ValueError ) as exc_info :
63
63
your_instance .build_migration_sequence ()
64
+ assert str (exc_info .value ) == "Cycle detected in migration sequence for migration1.py"
64
65
65
66
def test_build_migration_sequence (migration_instance ):
66
67
migration_sequence = migration_instance .build_migration_sequence ()
0 commit comments