Skip to content

Commit

Permalink
Merge pull request #39 from chantera/fix-entrypoint
Browse files Browse the repository at this point in the history
Change entrypoint name to simply be `black`
  • Loading branch information
ccordoba12 authored Dec 14, 2023
2 parents 007172c + d0afd7d commit 89216e7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ install_requires =
python_requires = >= 3.8

[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 @@ -294,7 +295,7 @@ def test_load_config_with_skip_options(config_with_skip_options):

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 @@ -348,3 +349,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

0 comments on commit 89216e7

Please sign in to comment.