[pre-commit.ci] pre-commit autoupdate by pre-commit-ci[bot] · Pull Request #276 · scientific-python/spin · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
2 changes: 1 addition & 1 deletion spin/cmds/meson.py
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ def docs(

if site_path:
os.environ["PYTHONPATH"] = (
f'{site_path}{os.sep}:{os.environ.get("PYTHONPATH", "")}'
f"{site_path}{os.sep}:{os.environ.get('PYTHONPATH', '')}"
)
click.secho(
f"$ export PYTHONPATH={os.environ['PYTHONPATH']}",
Expand Down
30 changes: 15 additions & 15 deletions spin/tests/test_build_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ def test_basic_build(example_pkg):
spin("build")

assert Path("build").exists(), "`build` folder not created after `spin build`"
assert Path(
"build-install"
).exists(), "`build-install` folder not created after `spin build`"
assert Path("build-install").exists(), (
"`build-install` folder not created after `spin build`"
)


def test_debug_builds(example_pkg):
Expand Down Expand Up @@ -64,17 +64,17 @@ def test_coverage_reports(example_pkg, report_type, output_file):
spin("test", "--gcov", f"--gcov-format={report_type}")

coverage_report = Path("./build/meson-logs", output_file)
assert (
coverage_report.exists()
), f"coverage report not generated for gcov build ({report_type})"
assert coverage_report.exists(), (
f"coverage report not generated for gcov build ({report_type})"
)


def test_expand_pythonpath(example_pkg):
"""Does an $ENV_VAR get expanded in `spin run`?"""
output = spin("run", "echo $PYTHONPATH")
assert any(
p in stdout(output) for p in ("site-packages", "dist-packages")
), f"Expected value of $PYTHONPATH, got {stdout(output)} instead"
assert any(p in stdout(output) for p in ("site-packages", "dist-packages")), (
f"Expected value of $PYTHONPATH, got {stdout(output)} instead"
)


def test_run_stdout(example_pkg):
Expand All @@ -85,9 +85,9 @@ def test_run_stdout(example_pkg):
"-c",
"import sys; del sys.path[0]; import example_pkg; print(example_pkg.__version__)",
)
assert (
stdout(p) == "0.0.0dev0"
), f"`spin run` stdout did not yield version, but {stdout(p)}"
assert stdout(p) == "0.0.0dev0", (
f"`spin run` stdout did not yield version, but {stdout(p)}"
)


# Detecting whether a file is executable is not that easy on Windows,
Expand All @@ -97,9 +97,9 @@ def test_recommend_run_python(example_pkg):
"""If `spin run file.py` is called, is `spin run python file.py` recommended?"""
with tempfile.NamedTemporaryFile(suffix=".py") as f:
p = spin("run", f.name, sys_exit=False)
assert "Did you mean to call" in stdout(
p
), "Failed to recommend `python run python file.py`"
assert "Did you mean to call" in stdout(p), (
"Failed to recommend `python run python file.py`"
)


def test_sdist(example_pkg):
Expand Down
6 changes: 3 additions & 3 deletions spin/tests/test_editable.py