-
-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: utility for showing system information
command to show system info output for bug reports Issue #426
- Loading branch information
Showing
4 changed files
with
60 additions
and
8 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
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,42 +1,72 @@ | ||
import platform | ||
import sys | ||
|
||
from commitizen import commands | ||
from commitizen.__version__ import __version__ | ||
|
||
|
||
def test_version_for_showing_project_version(config, capsys): | ||
# No version exist | ||
commands.Version(config, {"project": True, "commitizen": False, "verbose": False})() | ||
commands.Version( | ||
config, | ||
{"report": False, "project": True, "commitizen": False, "verbose": False}, | ||
)() | ||
captured = capsys.readouterr() | ||
assert "No project information in this project." in captured.err | ||
|
||
config.settings["version"] = "v0.0.1" | ||
commands.Version(config, {"project": True, "commitizen": False, "verbose": False})() | ||
commands.Version( | ||
config, | ||
{"report": False, "project": True, "commitizen": False, "verbose": False}, | ||
)() | ||
captured = capsys.readouterr() | ||
assert "v0.0.1" in captured.out | ||
|
||
|
||
def test_version_for_showing_commitizen_version(config, capsys): | ||
commands.Version(config, {"project": False, "commitizen": True, "verbose": False})() | ||
commands.Version( | ||
config, | ||
{"report": False, "project": False, "commitizen": True, "verbose": False}, | ||
)() | ||
captured = capsys.readouterr() | ||
assert f"{__version__}" in captured.out | ||
|
||
# default showing commitizen version | ||
commands.Version( | ||
config, {"project": False, "commitizen": False, "verbose": False} | ||
config, | ||
{"report": False, "project": False, "commitizen": False, "verbose": False}, | ||
)() | ||
captured = capsys.readouterr() | ||
assert f"{__version__}" in captured.out | ||
|
||
|
||
def test_version_for_showing_both_versions(config, capsys): | ||
commands.Version(config, {"project": False, "commitizen": False, "verbose": True})() | ||
commands.Version( | ||
config, | ||
{"report": False, "project": False, "commitizen": False, "verbose": True}, | ||
)() | ||
captured = capsys.readouterr() | ||
assert f"Installed Commitizen Version: {__version__}" in captured.out | ||
assert "No project information in this project." in captured.err | ||
|
||
config.settings["version"] = "v0.0.1" | ||
commands.Version(config, {"project": False, "commitizen": False, "verbose": True})() | ||
commands.Version( | ||
config, | ||
{"report": False, "project": False, "commitizen": False, "verbose": True}, | ||
)() | ||
captured = capsys.readouterr() | ||
expected_out = ( | ||
f"Installed Commitizen Version: {__version__}\n" f"Project Version: v0.0.1" | ||
) | ||
assert expected_out in captured.out | ||
|
||
|
||
def test_version_for_showing_commitizen_system_info(config, capsys): | ||
commands.Version( | ||
config, | ||
{"report": True, "project": False, "commitizen": False, "verbose": False}, | ||
)() | ||
captured = capsys.readouterr() | ||
assert f"Commitizen Version: {__version__}" in captured.out | ||
assert f"Python Version: {sys.version}" in captured.out | ||
assert f"Operating System: {platform.system()}" in captured.out |