MCPcopy Create free account
hub / github.com/commitizen-tools/commitizen / test_discover_plugins

Function test_discover_plugins

tests/test_factory.py:70–92  ·  view source on GitHub ↗
(tmp_path)

Source from the content-addressed store, hash-verified

68
69
70def test_discover_plugins(tmp_path):
71 legacy_plugin_folder = tmp_path / "cz_legacy"
72 legacy_plugin_folder.mkdir()
73 init_file = legacy_plugin_folder / "__init__.py"
74 init_file.write_text(
75 dedent(
76 """\
77 class Plugin: pass
78
79 discover_this = Plugin
80 """
81 )
82 )
83
84 sys.path.append(tmp_path.as_posix())
85 with pytest.warns(
86 UserWarning,
87 match="Legacy plugin 'cz_legacy' has been ignored: please expose it the 'commitizen.plugin' entrypoint",
88 ):
89 discovered_plugins = discover_plugins([tmp_path.as_posix()])
90 sys.path.pop()
91
92 assert "cz_legacy" not in discovered_plugins
93
94
95def test_discover_external_plugin(mocker):

Callers

nothing calls this directly

Calls 1

discover_pluginsFunction · 0.90

Tested by

no test coverage detected