Skip to content

Change entrypoint name to simply be black #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ install_requires = python-lsp-server>=1.4.0; black>=22.3.0; toml
python_requires = >= 3.7

[options.entry_points]
pylsp = pylsp_black = pylsp_black.plugin
pylsp = black = pylsp_black.plugin

[options.extras_require]
# add any types-* packages to .pre-commit-config.yaml mypy additional_dependencies
Expand Down
13 changes: 12 additions & 1 deletion tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
load_config,
pylsp_format_document,
pylsp_format_range,
pylsp_settings,
)

here = Path(__file__).parent
Expand Down Expand Up @@ -273,7 +274,7 @@ def test_load_config_defaults(config):

def test_entry_point():
distribution = pkg_resources.get_distribution("python-lsp-black")
entry_point = distribution.get_entry_info("pylsp", "pylsp_black")
entry_point = distribution.get_entry_info("pylsp", "black")

assert entry_point is not None

Expand Down Expand Up @@ -327,3 +328,13 @@ def test_cache_config(config, unformatted_document):
for _ in range(5):
pylsp_format_document(config, unformatted_document)
assert _load_config.cache_info().hits == 4


def test_pylsp_settings(config):
plugins = dict(config.plugin_manager.list_name_plugin())
assert "black" in plugins
assert plugins["black"] not in config.disabled_plugins
config.update({"plugins": {"black": {"enabled": False}}})
assert plugins["black"] in config.disabled_plugins
config.update(pylsp_settings())
assert plugins["black"] not in config.disabled_plugins