Skip to content

Commit 1e9a827

Browse files
committed
refactor(info): command logic removed from commitizen base
1 parent f1f5841 commit 1e9a827

File tree

4 files changed

+4
-22
lines changed

4 files changed

+4
-22
lines changed

commitizen/commands/info.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from commitizen import factory
1+
from commitizen import factory, out
22

33

44
class Info:
@@ -9,4 +9,4 @@ def __init__(self, config: dict, *args):
99
self.cz = factory.commiter_factory(self.config)
1010

1111
def __call__(self):
12-
self.cz.show_info()
12+
out.write(self.cz.info())

commitizen/cz/base.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,3 @@ def info(self) -> str:
3434

3535
def show_schema(self, *args, **kwargs):
3636
out.write(self.schema())
37-
38-
def show_info(self, *args, **kwargs):
39-
out.write(self.info())

tests/test_commands.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,14 @@ def test_commit(mocker):
2525

2626
def test_example():
2727
with mock.patch("commitizen.out.write") as write_mock:
28-
# mock_cz = mock.Mock()
29-
# mocked_factory.return_value = mock_cz
3028
commands.Example(config)()
3129
write_mock.assert_called_once()
3230

33-
# mocked_factory.assert_called_once()
34-
# mock_cz.show_example.assert_called_once()
35-
3631

3732
def test_info():
38-
with mock.patch("commitizen.factory.commiter_factory") as mocked_factory:
39-
mock_cz = mock.Mock()
40-
mocked_factory.return_value = mock_cz
33+
with mock.patch("commitizen.out.write") as write_mock:
4134
commands.Info(config)()
42-
43-
mocked_factory.assert_called_once()
44-
mock_cz.show_info.assert_called_once()
35+
write_mock.assert_called_once()
4536

4637

4738
def test_schema():

tests/test_cz_base.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,3 @@ def test_show_schema():
5050
cz = DummyCz(config)
5151
with pytest.raises(NotImplementedError):
5252
cz.show_schema()
53-
54-
55-
def test_show_info():
56-
cz = DummyCz(config)
57-
with pytest.raises(NotImplementedError):
58-
cz.show_info()

0 commit comments

Comments
 (0)