-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Clean up `show-positions` CLI command output, so that it works better if the output is long
- Loading branch information
Showing
6 changed files
with
86 additions
and
24 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,28 @@ | ||
"""Command show-positions with long output""" | ||
import os.path | ||
from contextlib import redirect_stdout | ||
from io import StringIO | ||
from pathlib import Path | ||
|
||
|
||
from tradeexecutor.cli.main import app | ||
|
||
def test_cli_show_positions_long(mocker): | ||
"""show-positions command work with long output of various output. | ||
""" | ||
path = Path(os.path.dirname(__file__)) / "show-positions-long.json" | ||
|
||
environment = { | ||
"STATE_FILE": path.as_posix(), | ||
} | ||
|
||
mocker.patch.dict("os.environ", environment, clear=True) | ||
|
||
f = StringIO() | ||
with redirect_stdout(f): | ||
app(["show-positions"], standalone_mode=False) | ||
|
||
assert "Open positions" in f.getvalue() | ||
assert "No frozen positions" in f.getvalue() | ||
|
||
|
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
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