Skip to content

Commit 6fa54a3

Browse files
committed
Correctly handle 3 digit version numbers.
1 parent 7eaf92a commit 6fa54a3

File tree

8 files changed

+19
-9
lines changed

8 files changed

+19
-9
lines changed

.github/workflows/python_ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: "windows-2019"
1414
continue-on-error: ${{ matrix.config.experimental }}
1515
env:
16-
USING_COVERAGE: '3.6,3.7,3.8,3.9,pypy-3.6,pypy-3.7'
16+
USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10.0-alpha.5,pypy-3.6,pypy-3.7'
1717

1818
strategy:
1919
fail-fast: False
@@ -23,6 +23,7 @@ jobs:
2323
- {python-version: "3.7", testenvs: "py37,build", experimental: False}
2424
- {python-version: "3.8", testenvs: "py38,build", experimental: False}
2525
- {python-version: "3.9", testenvs: "py39,build", experimental: False}
26+
- {python-version: "3.10.0-alpha.5", testenvs: "py310-dev,build", experimental: True}
2627
- {python-version: "pypy-3.6", testenvs: "pypy36,build", experimental: False}
2728
- {python-version: "pypy-3.7", testenvs: "pypy37,build", experimental: False}
2829

.github/workflows/python_ci_linux.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: "ubuntu-20.04"
1414
continue-on-error: ${{ matrix.config.experimental }}
1515
env:
16-
USING_COVERAGE: '3.6,3.7,3.8,3.9,pypy-3.6,pypy-3.7'
16+
USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10.0-alpha.5,pypy-3.6,pypy-3.7'
1717

1818
strategy:
1919
fail-fast: False
@@ -23,6 +23,7 @@ jobs:
2323
- {python-version: "3.7", testenvs: "py37,build", experimental: False}
2424
- {python-version: "3.8", testenvs: "py38,build", experimental: False}
2525
- {python-version: "3.9", testenvs: "py39,build", experimental: False}
26+
- {python-version: "3.10.0-alpha.5", testenvs: "py310-dev,build", experimental: True}
2627
- {python-version: "pypy-3.6", testenvs: "pypy36,build", experimental: False}
2728
- {python-version: "pypy-3.7", testenvs: "pypy37,build", experimental: False}
2829

.github/workflows/python_ci_macos.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: "macos-latest"
1414
continue-on-error: ${{ matrix.config.experimental }}
1515
env:
16-
USING_COVERAGE: '3.6,3.7,3.8,3.9,pypy-3.6,pypy-3.7'
16+
USING_COVERAGE: '3.6,3.7,3.8,3.9,3.10.0-alpha.5,pypy-3.6,pypy-3.7'
1717

1818
strategy:
1919
fail-fast: False
@@ -23,6 +23,7 @@ jobs:
2323
- {python-version: "3.7", testenvs: "py37,build", experimental: False}
2424
- {python-version: "3.8", testenvs: "py38,build", experimental: False}
2525
- {python-version: "3.9", testenvs: "py39,build", experimental: False}
26+
- {python-version: "3.10.0-alpha.5", testenvs: "py310-dev,build", experimental: True}
2627
- {python-version: "pypy-3.6", testenvs: "pypy36,build", experimental: False}
2728
- {python-version: "pypy-3.7", testenvs: "pypy37,build", experimental: False}
2829

coverage_pyver_pragma/grammar.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,20 +187,20 @@ def __init__(self, tokens: ParseResults):
187187
raise SyntaxError("Cannot combine a comparator with the plus sign.")
188188

189189
elif "plus" in token_dict:
190-
super().__init__(f">={version}")
190+
super().__init__(f">={version[0]}.{version[1:]}")
191191

192192
elif "comparator" in token_dict:
193193
comparator = token_dict["comparator"]
194-
super().__init__(f"{comparator}{version}")
194+
super().__init__(f"{comparator}{version[0]}.{version[1:]}")
195195

196196
else:
197-
super().__init__(f"=={version}")
197+
super().__init__(f"=={version[0]}.{version[1:]}")
198198

199199
def __repr__(self) -> str: # pragma: no cover
200200
return f"<{self.__class__.__name__}({str(self)!r})>"
201201

202202
def __bool__(self) -> bool:
203-
current_version = ''.join(platform.python_version_tuple()[:2])
203+
current_version = '.'.join(platform.python_version_tuple()[:2])
204204
return current_version in self
205205

206206

repo_helper.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ python_versions:
2323
- '3.7'
2424
- "3.8"
2525
- "3.9"
26+
- "3.10-dev"
2627
- pypy36
2728
- pypy37
2829

tests/test_plugin.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
pytest.param("3.7", marks=only_version(3.7, "Output differs on each version.")),
2121
pytest.param("3.8", marks=only_version(3.8, "Output differs on each version.")),
2222
pytest.param("3.9", marks=only_version(3.9, "Output differs on each version.")),
23+
pytest.param("3.10", marks=only_version("3.10", "Output differs on each version.")),
2324
])
2425
def test_plugin(tmp_pathplus: PathPlus, file_regression: FileRegressionFixture, version):
2526
coverage_pyver_pragma.coverage_init()
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Name Stmts Miss Cover
2+
----------------------------------------
3+
tests/demo_code.py 2 0 100%
4+
----------------------------------------
5+
TOTAL 2 0 100%

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# * pytest
1515

1616
[tox]
17-
envlist = py36, py37, py38, py39, pypy36, pypy37, mypy, build
17+
envlist = py36, py37, py38, py39, py310-dev, pypy36, pypy37, mypy, build
1818
skip_missing_interpreters = True
1919
isolated_build = True
2020
requires =
@@ -23,7 +23,7 @@ requires =
2323
tox-pip-version>=0.0.7
2424

2525
[envlists]
26-
test = py36, py37, py38, py39, pypy36, pypy37
26+
test = py36, py37, py38, py39, py310-dev, pypy36, pypy37
2727
qa = mypy, lint
2828
cov = py36, coverage
2929

0 commit comments

Comments
 (0)