Skip to content

Commit

Permalink
fix py37 statement
Browse files Browse the repository at this point in the history
  • Loading branch information
linshokaku committed Feb 20, 2024
1 parent e4756e2 commit e958f88
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ enable_isort = true
enable_mypy = true
mypy_preset = "strict"
line_length = 88
py_version = "py37"
py_version = "py38"
[[tool.pysen.lint.mypy_targets]]
paths = ["."]
```
Expand Down Expand Up @@ -215,7 +215,7 @@ enable_isort = true
enable_mypy = true
mypy_preset = "strict"
line_length = 88
py_version = "py37"
py_version = "py38"
isort_known_third_party = ["numpy"]
isort_known_first_party = ["pysen"]
mypy_ignore_packages = ["pysen.generated.*"]
Expand Down
2 changes: 1 addition & 1 deletion examples/simple_package/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ enable_black = true
enable_mypy = true
mypy_preset = "strict"
line_length = 100
py_version = "py37"
py_version = "py38"

[[tool.pysen.lint.mypy_targets]]
paths = ["."]
2 changes: 1 addition & 1 deletion examples/sync_cmdclass_pyproject/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ enable_black = true
enable_mypy = true
mypy_preset = "strict"
line_length = 100
py_version = "py37"
py_version = "py38"

[[tool.pysen.lint.mypy_targets]]
paths = ["."]
2 changes: 1 addition & 1 deletion pysen/ext/black_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def default(
# NOTE(igarashi) safe to use as an argument since it is immutable
py_version: Optional[PythonVersion] = None,
) -> "BlackSetting":
py_version = py_version or PythonVersion(3, 7)
py_version = py_version or PythonVersion(3, 8)
return BlackSetting(target_version=[py_version])

def export(self) -> Tuple[List[str], Dict[str, Any]]:
Expand Down
2 changes: 1 addition & 1 deletion pysen/ext/flake8_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def export(self) -> Tuple[Sequence[str], Dict[str, Any]]:
@functools.lru_cache(1)
def _check_flake8_version() -> None:
version = get_version("flake8")
minimum_supported = VersionRepresentation(3, 7)
minimum_supported = VersionRepresentation(3, 8)
if version < minimum_supported:
raise IncompatibleVersionError(
f"pysen only supports flake8 >= {minimum_supported}, "
Expand Down
2 changes: 1 addition & 1 deletion pysen/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def configure_lint(options: ConfigureLintOptions) -> List[ComponentBase]:
if options.py_version is not None:
python_version = options.py_version
else:
python_version = PythonVersion(3, 7)
python_version = PythonVersion(3, 8)

line_length = options.line_length or 88

Expand Down
2 changes: 1 addition & 1 deletion tests/fakes/configs/base.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
base = "base2.toml"
enable_isort = true
line_length = 88
py_version = "py37"
py_version = "py38"
isort_known_third_party = ["fuga", "piyo"]
isort_known_first_party = ["foo"]

Expand Down
2 changes: 1 addition & 1 deletion tests/fakes/configs/example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ enable_isort = true
enable_mypy = true
mypy_preset = "strict"
line_length = 88
py_version = "py37"
py_version = "py38"
isort_known_first_party = ["alpha"]
isort_known_third_party = ["beta", "gamma"]
mypy_ignore_packages = ["pysen.stubs", "pysen.proto"]
Expand Down
2 changes: 1 addition & 1 deletion tests/fakes/configs/non_pysen_config.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[tool.nonpysen]
line-length = 100
target-version = ["py37"]
target-version = ["py38"]
26 changes: 13 additions & 13 deletions tests/test_py_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@


def test_python_version() -> None:
py37 = PythonVersion(3, 7)
py38 = PythonVersion(3, 8)

assert py37 == PythonVersion(3, 7)
assert py37 != PythonVersion(3, 8)
assert py38 == PythonVersion(3, 8)
assert py38 != PythonVersion(3, 9)

assert py37.version == "3.7"
assert py37.full_representation == "Python3.7"
assert py37.short_representation == "py37"
assert py38.version == "3.8"
assert py38.full_representation == "Python3.8"
assert py38.short_representation == "py38"

py378 = PythonVersion(3, 7, 8)
py388 = PythonVersion(3, 8, 8)

assert py378 == PythonVersion(3, 7, 8)
assert py378 != PythonVersion(3, 7, 9)
assert py378 != py37
assert py388 == PythonVersion(3, 8, 8)
assert py388 != PythonVersion(3, 8, 9)
assert py388 != py38

assert py378.version == "3.7.8"
assert py378.full_representation == "Python3.7.8"
assert py378.short_representation == "py37"
assert py388.version == "3.8.8"
assert py388.full_representation == "Python3.8.8"
assert py388.short_representation == "py38"


def test_version_ops() -> None:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_pyproject_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,15 @@ def test__parse_source() -> None:


def test__parse_python_version() -> None:
assert _parse_python_version("py37") == PythonVersion(3, 7)
assert _parse_python_version("py38") == PythonVersion(3, 8)
assert _parse_python_version("PY38") == PythonVersion(3, 8)
with pytest.raises(dacite.DaciteError) as ex:
_parse_python_version("PY999")

assert "one of" in str(ex.value) # ensure that we suggest some options

with pytest.raises(dacite.WrongTypeError):
_parse_python_version(37)
_parse_python_version(38)


def test__parse_mypy_target() -> None:
Expand Down Expand Up @@ -291,7 +291,7 @@ def test_example() -> None:
assert lint.enable_mypy
assert lint.line_length == 88
assert isinstance(lint.line_length, int)
assert lint.py_version == PythonVersion(3, 7)
assert lint.py_version == PythonVersion(3, 8)
assert lint.isort_known_first_party == ["alpha"]
assert lint.isort_known_third_party == ["beta", "gamma"]
assert lint.isort_default_section == IsortSectionName.THIRDPARTY
Expand Down

0 comments on commit e958f88

Please sign in to comment.