Skip to content

Commit

Permalink
Drop Python 3.6, add support for 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus committed Jan 25, 2022
1 parent 0b869db commit cb4d567
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ jobs:
strategy:
fail-fast: false
matrix:
python: ["3.6", "3.7", "3.8", "3.9"]
python: ["3.7", "3.8", "3.9", "3.10"]
os: [ubuntu-latest, windows-latest]
include:
- python: "3.6"
tox_env: "py36"
- python: "3.7"
tox_env: "py37"
- python: "3.8"
tox_env: "py38"
- python: "3.9"
tox_env: "py39"
- python: "3.10"
tox_env: "py310"

steps:
- uses: actions/checkout@v1
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
3.7.0 (UNRELEASED)
------------------

* Python 3.10 now officially supported.
* Dropped support for Python 3.6.

3.6.1 (2021-05-06)
------------------

Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
package_data={
"pytest_mock": ["py.typed"],
},
python_requires=">=3.6",
python_requires=">=3.7",
install_requires=["pytest>=5.0"],
use_scm_version={"write_to": "src/pytest_mock/_version.py"},
setup_requires=["setuptools_scm"],
Expand All @@ -31,10 +31,10 @@
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3 :: Only",
"Topic :: Software Development :: Testing",
],
Expand Down
10 changes: 5 additions & 5 deletions tests/test_pytest_mock.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def test_repr_with_no_name(self, mocker: MockerFixture) -> None:
def test_repr_with_name(self, mocker: MockerFixture) -> None:
test_name = "funny walk"
stub = mocker.stub(name=test_name)
assert "name={!r}".format(test_name) in repr(stub)
assert f"name={test_name!r}" in repr(stub)

def __test_failure_message(self, mocker: MockerFixture, **kwargs: Any) -> None:
expected_name = kwargs.get("name") or "mock"
Expand Down Expand Up @@ -267,19 +267,19 @@ def test_instance_method_spy_exception(
) -> None:
class Foo:
def bar(self, arg):
raise exc_cls("Error with {}".format(arg))
raise exc_cls(f"Error with {arg}")

foo = Foo()
spy = mocker.spy(foo, "bar")

expected_calls = []
for i, v in enumerate([10, 20]):
with pytest.raises(exc_cls, match="Error with {}".format(v)):
with pytest.raises(exc_cls, match=f"Error with {v}"):
foo.bar(arg=v)

expected_calls.append(mocker.call(arg=v))
assert foo.bar.call_args_list == expected_calls # type:ignore[attr-defined]
assert str(spy.spy_exception) == "Error with {}".format(v)
assert str(spy.spy_exception) == f"Error with {v}"


def test_instance_method_spy_autospec_true(mocker: MockerFixture) -> None:
Expand All @@ -296,7 +296,7 @@ def bar(self, arg):


def test_spy_reset(mocker: MockerFixture) -> None:
class Foo(object):
class Foo:
def bar(self, x):
if x == 0:
raise ValueError("invalid x")
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
minversion = 3.5.3
envlist = py{35,36,37,38,39}, linting, norewrite
envlist = py{37,38,39,310}, linting, norewrite

[testenv]
passenv = USER USERNAME
Expand Down

0 comments on commit cb4d567

Please sign in to comment.