-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
51 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from testutil import spin, stdout | ||
|
||
import spin as libspin | ||
|
||
|
||
def test_get_version(): | ||
p = spin("--version") | ||
assert stdout(p) == f"spin {libspin.__version__}" | ||
|
||
|
||
def test_arg_override(): | ||
p = spin("example") | ||
assert "--test is: default override" in stdout(p) | ||
assert "Default kwd is: 3" in stdout(p) | ||
|
||
p = spin("example", "-t", 6) | ||
assert "--test is: 6" in stdout(p) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import subprocess | ||
import sys | ||
|
||
import pytest | ||
|
||
from spin.cmds.util import run | ||
|
||
skip_on_windows = pytest.mark.skipif( | ||
sys.platform.startswith("win"), reason="Skipped; platform is Windows" | ||
) | ||
|
||
skip_unless_linux = pytest.mark.skipif( | ||
not sys.platform.startswith("linux"), reason="Skipped; platform not Linux" | ||
) | ||
|
||
|
||
def spin(*args, **user_kwargs): | ||
args = (str(el) for el in args) | ||
default_kwargs = { | ||
"stdout": subprocess.PIPE, | ||
"stderr": subprocess.PIPE, | ||
"sys_exit": True, | ||
} | ||
return run(["spin"] + list(args), **{**default_kwargs, **user_kwargs}) | ||
|
||
|
||
def stdout(p): | ||
return p.stdout.decode("utf-8").strip() | ||
|
||
|
||
def stderr(p): | ||
return p.stderr.decode("utf-8").strip() |
This file was deleted.
Oops, something went wrong.