-
Notifications
You must be signed in to change notification settings - Fork 3
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
1 parent
4958e7d
commit bb2e705
Showing
2 changed files
with
37 additions
and
4 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,27 @@ | ||
import subprocess | ||
import sys | ||
import uuid | ||
from io import StringIO | ||
|
||
from dysh.shell import init_shell | ||
|
||
|
||
def test_shell_cli(): | ||
"""Simply prove that we can launch $ dysh from CLI""" | ||
subprocess.check_call(["dysh"]) | ||
|
||
|
||
def test_init_shell(monkeypatch): | ||
"""Prove that we can open the shell, print something, and exit without error""" | ||
|
||
# Generate a unique string that we will look for in stdout later | ||
test_str = uuid.uuid4().hex.upper() | ||
mock_input = StringIO(f"print('{test_str}')\n") | ||
monkeypatch.setattr(sys, "stdin", mock_input) | ||
|
||
mock_stdout = StringIO() | ||
monkeypatch.setattr(sys, "stdout", mock_stdout) | ||
init_shell("--no-banner", colors="NoColor", profile="dysh") | ||
|
||
mock_stdout.seek(0) | ||
assert test_str in mock_stdout.read() |