File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -165,12 +165,15 @@ def upgrade():
165165 )
166166 import os
167167
168- os .chmod (repo / "migrations" / "versions" / "026_unreadable.py" , 0o000 )
169- with patch ("sys.argv" , ["squawk-alembic" , path ]):
170- assert main () == 1
171- os .chmod (repo / "migrations" / "versions" / "026_unreadable.py" , 0o644 )
172- captured = capsys .readouterr ()
173- assert "cannot read migration file" in captured .err
168+ unreadable = repo / "migrations" / "versions" / "026_unreadable.py"
169+ os .chmod (unreadable , 0o000 )
170+ try :
171+ with patch ("sys.argv" , ["squawk-alembic" , path ]):
172+ assert main () == 1
173+ captured = capsys .readouterr ()
174+ assert "cannot read migration file" in captured .err
175+ finally :
176+ os .chmod (unreadable , 0o644 )
174177
175178
176179def test_missing_alembic_binary (repo , capsys ):
You can’t perform that action at this time.
0 commit comments