Skip to content

Commit

Permalink
Fix problem pointed out by flake
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Jul 5, 2022
1 parent f814cd5 commit 22876ea
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/test_operations.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import stat
from unittest.mock import Mock

from pyscaffold.operations import (
add_permissions,
Expand Down Expand Up @@ -66,15 +67,15 @@ def test_skip_on_update(monkeypatch):
path = uniqpath()
for existing in (True, False):
with monkeypatch.context() as patch:
patch.setattr("pathlib.Path.exists", lambda _: existing)
patch.setattr("pathlib.Path.exists", Mock(return_value=existing))
assert SKIP_ON_UPDATE(path, "contents", opts) is None

# When force is True, execute, even if file exists
opts = {"update": True, "force": True}
path = uniqpath()
for existing in (True, False):
with monkeypatch.context() as patch:
patch.setattr("pathlib.Path.exists", lambda _: existing)
patch.setattr("pathlib.Path.exists", Mock(return_value=existing))
assert SKIP_ON_UPDATE(path, "contents", opts) == path


Expand All @@ -98,7 +99,7 @@ def test_no_overwrite(monkeypatch):
path = uniqpath()
for existing in (True, False):
with monkeypatch.context() as patch:
patch.setattr("pathlib.Path.exists", lambda _: existing)
patch.setattr("pathlib.Path.exists", Mock(return_value=existing))
assert NO_OVERWRITE(path, "contents", opts) == path


Expand Down

0 comments on commit 22876ea

Please sign in to comment.