Skip to content

Commit

Permalink
Refactor editable tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanv committed May 1, 2024
1 parent cd25bdf commit 215cee6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
11 changes: 0 additions & 11 deletions spin/tests/test_build_cmds.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,17 +76,6 @@ def test_run_stdout():
), f"`spin run` stdout did not yield version, but {stdout(p)}"


def test_editable_conflict():
"""Do we warn when a conflicting editable install is present?"""
try:
run(["pip", "install", "--quiet", "-e", "."])
assert "Warning! An editable installation" in stdout(
spin("run", "ls")
), "Failed to detect and warn about editable install"
finally:
run(["pip", "uninstall", "--quiet", "-y", "example_pkg"])


# Detecting whether a file is executable is not that easy on Windows,
# as it seems to take into consideration whether that file is associated as an executable.
@skip_on_windows
Expand Down
21 changes: 21 additions & 0 deletions spin/tests/test_editable.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import pytest
from testutil import spin, stdout

from spin.cmds.util import run


@pytest.fixture
def editable_install():
run(["pip", "install", "--quiet", "--no-build-isolation", "-e", "."])
yield
run(["pip", "uninstall", "--quiet", "-y", "example_pkg"])


def test_detect_editable(editable_install):
assert "Editable install of same source detected" in stdout(
spin("build")
), "Failed to detect and warn about editable install"


def test_editable_tests(editable_install):
spin("test")

0 comments on commit 215cee6

Please sign in to comment.