-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from TGoddessana/improve-test
Improve test, remove uncecessary codes
- Loading branch information
Showing
5 changed files
with
23 additions
and
41 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import pytest | ||
from flask import Flask | ||
|
||
|
||
@pytest.fixture | ||
def app() -> Flask: | ||
app = Flask(__name__) | ||
app.config["TESTING"] = True | ||
return app |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,18 @@ | ||
from importlib.metadata import version | ||
|
||
import pytest | ||
from flask import Flask | ||
|
||
from flask_moreshell.shells.ptpython_shell import PTPythonShell | ||
|
||
|
||
@pytest.fixture | ||
def app(): | ||
app = Flask(__name__) | ||
app.config["TESTING"] = True | ||
return app | ||
|
||
|
||
@pytest.fixture | ||
def ptpython_shell(): | ||
def ptpython_shell() -> PTPythonShell: | ||
return PTPythonShell() | ||
|
||
|
||
def test_get_shell_name(ptpython_shell): | ||
def test_get_shell_name(ptpython_shell: PTPythonShell) -> None: | ||
assert ptpython_shell.get_shell_name() == "PTPython" | ||
|
||
|
||
def test_get_shell_version(ptpython_shell): | ||
def test_get_shell_version(ptpython_shell: PTPythonShell) -> None: | ||
assert ptpython_shell.get_shell_version() == version("ptpython") | ||
|
||
|
||
def test_load(ptpython_shell, monkeypatch, capsys, app): | ||
with app.app_context(): | ||
ptpython_shell.load() | ||
|
||
stdout = capsys.readouterr().out | ||
|
||
assert ptpython_shell.get_shell_name() in stdout | ||
assert ptpython_shell.get_shell_version() in stdout | ||
assert "PTPython" in stdout |
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