Skip to content

Commit

Permalink
Merge pull request #7912 from hugovk/rm-3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
nicoddemus authored Oct 19, 2020
2 parents f61d4ed + c9e5042 commit f453460
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 60 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Features
- Can run `unittest <https://docs.pytest.org/en/stable/unittest.html>`_ (or trial),
`nose <https://docs.pytest.org/en/stable/nose.html>`_ test suites out of the box

- Python 3.5+ and PyPy3
- Python 3.6+ and PyPy3

- Rich plugin architecture, with over 850+ `external plugins <http://plugincompat.herokuapp.com>`_ and thriving community

Expand Down
2 changes: 1 addition & 1 deletion doc/en/getting-started.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Installation and Getting Started
===================================

**Pythons**: Python 3.5, 3.6, 3.7, 3.8, 3.9, PyPy3
**Pythons**: Python 3.6, 3.7, 3.8, 3.9, PyPy3

**Platforms**: Linux and Windows

Expand Down
2 changes: 1 addition & 1 deletion doc/en/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Features

- Can run :ref:`unittest <unittest>` (including trial) and :ref:`nose <noseintegration>` test suites out of the box

- Python 3.5+ and PyPy 3
- Python 3.6+ and PyPy 3

- Rich plugin architecture, with over 315+ `external plugins <http://plugincompat.herokuapp.com>`_ and thriving community

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ filterwarnings = [
"ignore:.*U.*mode is deprecated:DeprecationWarning:(?!(pytest|_pytest))",
# produced by pytest-xdist
"ignore:.*type argument to addoption.*:DeprecationWarning",
# produced by python >=3.5 on execnet (pytest-xdist)
# produced on execnet (pytest-xdist)
"ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning",
# pytest's own futurewarnings
"ignore::pytest.PytestExperimentalApiWarning",
Expand Down
4 changes: 2 additions & 2 deletions src/_pytest/assertion/rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def find_spec(
spec is None
# this is a namespace package (without `__init__.py`)
# there's nothing to rewrite there
# python3.5 - python3.6: `namespace`
# python3.6: `namespace`
# python3.7+: `None`
or spec.origin == "namespace"
or spec.origin is None
Expand Down Expand Up @@ -1005,7 +1005,7 @@ def visit_Call(self, call: ast.Call) -> Tuple[ast.Name, str]:
return res, outer_expl

def visit_Starred(self, starred: ast.Starred) -> Tuple[ast.Starred, str]:
# From Python 3.5, a Starred node can appear in a function call.
# A Starred node can appear in a function call.
res, expl = self.visit(starred.value)
new_starred = ast.Starred(res, starred.ctx)
return new_starred, "*" + expl
Expand Down
4 changes: 1 addition & 3 deletions src/_pytest/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,7 @@ def writeorg(self, data):
class CaptureResult(Generic[AnyStr]):
"""The result of :method:`CaptureFixture.readouterr`."""

# Can't use slots in Python<3.5.3 due to https://bugs.python.org/issue31272
if sys.version_info >= (3, 5, 3):
__slots__ = ("out", "err")
__slots__ = ("out", "err")

def __init__(self, out: AnyStr, err: AnyStr) -> None:
self.out: AnyStr = out
Expand Down
2 changes: 1 addition & 1 deletion src/_pytest/python_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ def approx(expected, rel=None, abs=None, nan_ok: bool = False) -> ApproxBase:
both ``a`` and ``b``, this test is symmetric (i.e. neither ``a`` nor
``b`` is a "reference value"). You have to specify an absolute tolerance
if you want to compare to ``0.0`` because there is no tolerance by
default. Only available in python>=3.5. `More information...`__
default. `More information...`__
__ https://docs.python.org/3/library/math.html#math.isclose
Expand Down
11 changes: 2 additions & 9 deletions testing/code/test_excinfo.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import importlib
import io
import operator
import os
Expand All @@ -20,13 +21,6 @@
from _pytest._io import TerminalWriter
from _pytest.pytester import LineMatcher

try:
import importlib
except ImportError:
invalidate_import_caches = None
else:
invalidate_import_caches = getattr(importlib, "invalidate_caches", None)

if TYPE_CHECKING:
from _pytest._code.code import _TracebackStyle

Expand Down Expand Up @@ -445,8 +439,7 @@ def importasmod(source):
modpath = tmpdir.join("mod.py")
tmpdir.ensure("__init__.py")
modpath.write(source)
if invalidate_import_caches is not None:
invalidate_import_caches()
importlib.invalidate_caches()
return modpath.pyimport()

return importasmod
Expand Down
5 changes: 0 additions & 5 deletions testing/python/raises.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,6 @@ def test_raises_cyclic_reference(self, method):

class T:
def __call__(self):
# Early versions of Python 3.5 have some bug causing the
# __call__ frame to still refer to t even after everything
# is done. This makes the test pass for them.
if sys.version_info < (3, 5, 2):
del self
raise ValueError

t = T()
Expand Down
45 changes: 9 additions & 36 deletions testing/test_reports.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
from pathlib import Path
from typing import Sequence
from typing import Union
Expand Down Expand Up @@ -346,44 +345,18 @@ def test_chained_exceptions_no_reprcrash(self, testdir: Testdir, tw_mock) -> Non
from subprocess to main process creates an artificial exception, which ExceptionInfo
can't obtain the ReprFileLocation from.
"""
# somehow in Python 3.5 on Windows this test fails with:
# File "c:\...\3.5.4\x64\Lib\multiprocessing\connection.py", line 302, in _recv_bytes
# overlapped=True)
# OSError: [WinError 6] The handle is invalid
#
# so in this platform we opted to use a mock traceback which is identical to the
# one produced by the multiprocessing module
if sys.version_info[:2] <= (3, 5) and sys.platform.startswith("win"):
testdir.makepyfile(
"""
# equivalent of multiprocessing.pool.RemoteTraceback
class RemoteTraceback(Exception):
def __init__(self, tb):
self.tb = tb
def __str__(self):
return self.tb
def test_a():
try:
raise ValueError('value error')
except ValueError as e:
# equivalent to how multiprocessing.pool.rebuild_exc does it
e.__cause__ = RemoteTraceback('runtime error')
raise e
testdir.makepyfile(
"""
)
else:
testdir.makepyfile(
"""
from concurrent.futures import ProcessPoolExecutor
from concurrent.futures import ProcessPoolExecutor
def func():
raise ValueError('value error')
def func():
raise ValueError('value error')
def test_a():
with ProcessPoolExecutor() as p:
p.submit(func).result()
"""
)
def test_a():
with ProcessPoolExecutor() as p:
p.submit(func).result()
"""
)

testdir.syspathinsert()
reprec = testdir.inline_run()
Expand Down

0 comments on commit f453460

Please sign in to comment.