Skip to content

Commit

Permalink
Merge pull request #53 from ccordoba12/drop-py37
Browse files Browse the repository at this point in the history
Drop support for Python 3.7
  • Loading branch information
ccordoba12 authored Dec 5, 2023
2 parents 27200ee + 174ece4 commit 007172c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9, "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down
8 changes: 0 additions & 8 deletions pylsp_black/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,6 @@ def _load_config(filename: str, client_config: Config) -> Dict:
target_version = set(
black.TargetVersion[x.upper()] for x in file_config["target_version"]
)
elif file_config.get("py36"):
target_version = {
black.TargetVersion.PY36,
black.TargetVersion.PY37,
black.TargetVersion.PY38,
black.TargetVersion.PY39,
black.TargetVersion.PY310,
}
else:
target_version = set()

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tool.black]
target-version = ['py36', 'py37', 'py38', 'py39', 'py310']
target-version = ['py38', 'py39', 'py310', 'py311']
exclude = '''
/(
\.venv
Expand Down
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
tomli; python_version<'3.11'
python_requires = >= 3.7
python_requires = >= 3.8

[options.entry_points]
pylsp = pylsp_black = pylsp_black.plugin
Expand Down
2 changes: 0 additions & 2 deletions tests/fixtures/py36/pyproject.toml

This file was deleted.

32 changes: 10 additions & 22 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,21 @@ def config_with_skip_options(workspace):
@pytest.fixture
def unformatted_document(workspace):
path = fixtures_dir / "unformatted.txt"
uri = f"file:/{path}"
uri = f"file:/{path}" # noqa
return Document(uri, workspace)


@pytest.fixture
def unformatted_pyi_document(workspace):
path = fixtures_dir / "unformatted.pyi"
uri = f"file:/{path}"
uri = f"file:/{path}" # noqa
return Document(uri, workspace)


@pytest.fixture
def unformatted_crlf_document(workspace):
path = fixtures_dir / "unformatted-crlf.py"
uri = f"file:/{path}"
uri = f"file:/{path}" # noqa
with open(path, "r", newline="") as f:
source = f.read()
return Document(uri, workspace, source=source)
Expand All @@ -84,21 +84,21 @@ def unformatted_crlf_document(workspace):
@pytest.fixture
def formatted_document(workspace):
path = fixtures_dir / "formatted.txt"
uri = f"file:/{path}"
uri = f"file:/{path}" # noqa
return Document(uri, workspace)


@pytest.fixture
def formatted_pyi_document(workspace):
path = fixtures_dir / "formatted.pyi"
uri = f"file:/{path}"
uri = f"file:/{path}" # noqa
return Document(uri, workspace)


@pytest.fixture
def formatted_crlf_document(workspace):
path = fixtures_dir / "formatted-crlf.py"
uri = f"file:/{path}"
uri = f"file:/{path}" # noqa
with open(path, "r", newline="") as f:
source = f.read()
return Document(uri, workspace, source=source)
Expand All @@ -107,28 +107,28 @@ def formatted_crlf_document(workspace):
@pytest.fixture
def invalid_document(workspace):
path = fixtures_dir / "invalid.txt"
uri = f"file:/{path}"
uri = f"file:/{path}" # noqa
return Document(uri, workspace)


@pytest.fixture
def config_document(workspace):
path = fixtures_dir / "config" / "config.txt"
uri = f"file:/{path}"
uri = f"file:/{path}" # noqa
return Document(uri, workspace)


@pytest.fixture
def unformatted_line_length(workspace):
path = fixtures_dir / "unformatted-line-length.py"
uri = f"file:/{path}"
uri = f"file:/{path}" # noqa
return Document(uri, workspace)


@pytest.fixture
def formatted_line_length(workspace):
path = fixtures_dir / "formatted-line-length.py"
uri = f"file:/{path}"
uri = f"file:/{path}" # noqa
return Document(uri, workspace)


Expand Down Expand Up @@ -262,18 +262,6 @@ def test_load_config_target_version(config):
assert config["target_version"] == {black.TargetVersion.PY39}


def test_load_config_py36(config):
config = load_config(str(fixtures_dir / "py36" / "example.py"), config)

assert config["target_version"] == {
black.TargetVersion.PY36,
black.TargetVersion.PY37,
black.TargetVersion.PY38,
black.TargetVersion.PY39,
black.TargetVersion.PY310,
}


def test_load_config_defaults(config):
config = load_config(str(fixtures_dir / "example.py"), config)

Expand Down

0 comments on commit 007172c

Please sign in to comment.