Skip to content

Commit 6503ff0

Browse files
authored
add path exists checks to cleanup
1 parent 34cee83 commit 6503ff0

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

tests/api/v2/handlers/test_abilities_api.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ def new_ability_payload():
3232
}
3333

3434
# Ability cleanup
35-
try:
36-
os.remove('data/abilities/collection/456.yml')
37-
except OSError:
38-
pass
35+
if os.path.exists('data/abilities/collection/456.yml'):
36+
try:
37+
os.remove('data/abilities/collection/456.yml')
38+
except OSError:
39+
pass
3940

4041

4142
@pytest.fixture
@@ -67,10 +68,11 @@ def test_ability(event_loop, api_v2_client, executor):
6768
yield ability
6869

6970
# cleanup
70-
try:
71-
os.remove('data/abilities/collection/123.yml')
72-
except OSError:
73-
pass
71+
if os.path.exists('data/abilities/collection/123.yml'):
72+
try:
73+
os.remove('data/abilities/collection/123.yml')
74+
except OSError:
75+
pass
7476

7577

7678
class TestAbilitiesApi:

0 commit comments

Comments
 (0)