Skip to content

Commit

Permalink
Make some ruff fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cclauss committed Feb 21, 2023
1 parent f9205c3 commit 446064e
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/pyscaffold/file_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def on_ro_error(func, path, exc_info):
sleep(0.5)

if not Path(path).exists():
return
return None

if not os.access(path, os.W_OK):
# Is the error an access error ?
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def tmpfolder(tmpdir):
@pytest.fixture
def git_mock(monkeypatch, logger):
def _git(*args, **kwargs):
cmd = " ".join(["git"] + list(args))
cmd = " ".join(["git", *list(args)])

logger.report("run", cmd, context=os.getcwd())

Expand Down
4 changes: 2 additions & 2 deletions tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def set_writable(func, path, exc_info):
try:
return func(path)
except FileNotFoundError:
return
return None
else:
# For some weird reason we do have rights to remove the dir,
# let's try again a few times more slowly (maybe a previous OS call
Expand All @@ -75,7 +75,7 @@ def set_writable(func, path, exc_info):
try:
return rmtree(path)
except FileNotFoundError:
return
return None
except OSError:
sleep((i + 1) * retry_interval)

Expand Down
5 changes: 2 additions & 3 deletions tests/system/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,8 @@ def test_putup_with_update(cwd, putup):

def test_putup_with_update_dirty_workspace(cwd, putup):
run(f"{putup} myproj")
with chdir("myproj"):
with open("setup.py", "w") as fh:
fh.write("DIRTY")
with chdir("myproj"), open("setup.py", "w") as fh:
fh.write("DIRTY")
with pytest.raises(CalledProcessError):
run(f"{putup} --update myproj")
run(f"{putup} --update myproj --force")
Expand Down
2 changes: 1 addition & 1 deletion tests/test_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def fake_action(struct, opts):
return struct, opts

def extension(actions):
return [fake_action] + actions
return [fake_action, *actions]

# When discover is called,
actions = discover([extension])
Expand Down
2 changes: 1 addition & 1 deletion tests/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def test_config_file_default(monkeypatch):

def test_best_fit_license():
# If the name matches => return the name
for license in templates.licenses.keys():
for license in templates.licenses:
assert info.best_fit_license(license) == license
# Lower case
assert info.best_fit_license("0bsd") == "0BSD"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def test_all_licenses():
"author": "myself",
"year": 1832,
}
for license in templates.licenses.keys():
for license in templates.licenses:
opts["license"] = license
assert templates.license(opts)

Expand Down
4 changes: 2 additions & 2 deletions tests/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ def putup(self, *args, with_coverage=False, **kwargs):
# need to pass here as list since its args to coverage.py
args = [subarg for arg in args for subarg in arg.split()]
putup_path = Path(self.venv_path, "bin", "putup")
cmd = list(map(str, [putup_path] + args))
cmd = list(map(str, [putup_path, *args]))
else:
# need to pass here as string since it's the cmd itself
cmd = " ".join(["putup"] + list(map(str, args)))
cmd = " ".join(["putup", *list(map(str, args))])
self.run(cmd, with_coverage=with_coverage, **kwargs)
return self

Expand Down

0 comments on commit 446064e

Please sign in to comment.