Skip to content

Commit 9cd23ab

Browse files
committed
Drop Python 2.7 and 3.4 support
* Update setup.py requires and classifiers * Drop Python 2.7 and 3.4 from CI * Update docs dropping 2.7 and 3.4 support * Fix mock imports and remove tests related to pypi's mock module * Add py27 and 34 support docs to the sidebar * Remove usage of six from tmpdir * Remove six.PY* code blocks * Remove sys.version_info related code * Cleanup compat * Remove obsolete safe_str * Remove obsolete __unicode__ methods * Remove compat.PY35 and compat.PY36: not really needed anymore * Remove unused UNICODE_TYPES * Remove Jython specific code * Remove some Python 2 references from docs Related to #5275
1 parent 733f43b commit 9cd23ab

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+222
-1321
lines changed

.travis.yml

Lines changed: 7 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,39 +19,28 @@ install:
1919
jobs:
2020
include:
2121
# OSX tests - first (in test stage), since they are the slower ones.
22-
- &test-macos
23-
os: osx
22+
- os: osx
23+
# NOTE: (tests with) pexpect appear to be buggy on Travis,
24+
# at least with coverage.
25+
# Log: https://travis-ci.org/pytest-dev/pytest/jobs/500358864
2426
osx_image: xcode10.1
2527
language: generic
26-
# Coverage for:
27-
# - py2 with symlink in test_cmdline_python_package_symlink.
28-
env: TOXENV=py27-xdist PYTEST_COVERAGE=1
29-
before_install:
30-
- python -V
31-
- test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 27
32-
- <<: *test-macos
33-
env: TOXENV=py37-pexpect,py37-xdist PYTEST_COVERAGE=1
28+
env: TOXENV=py37-xdist PYTEST_COVERAGE=1
3429
before_install:
3530
- which python3
3631
- python3 -V
3732
- ln -sfn "$(which python3)" /usr/local/bin/python
3833
- python -V
3934
- test $(python -c 'import sys; print("%d%d" % sys.version_info[0:2])') = 37
4035

41-
# Full run of latest (major) supported versions, without xdist.
42-
- env: TOXENV=py27
43-
python: '2.7'
36+
# Full run of latest supported version, without xdist.
4437
- env: TOXENV=py37
4538
python: '3.7'
4639

4740
# Coverage tracking is slow with pypy, skip it.
48-
- env: TOXENV=pypy-xdist
49-
python: 'pypy'
5041
- env: TOXENV=pypy3-xdist
5142
python: 'pypy3'
5243

53-
- env: TOXENV=py34-xdist
54-
python: '3.4'
5544
- env: TOXENV=py35-xdist
5645
python: '3.5'
5746

@@ -62,12 +51,6 @@ jobs:
6251
# Empty PYTEST_ADDOPTS to run this non-verbose.
6352
- env: TOXENV=py37-lsof-numpy-xdist PYTEST_COVERAGE=1 PYTEST_ADDOPTS=
6453

65-
# Specialized factors for py27.
66-
- env: TOXENV=py27-nobyte-numpy-xdist
67-
python: '2.7'
68-
- env: TOXENV=py27-pluggymaster-xdist
69-
python: '2.7'
70-
7154
# Specialized factors for py37.
7255
# Coverage for:
7356
# - test_sys_breakpoint_interception (via pexpect).
@@ -81,12 +64,7 @@ jobs:
8164
if: type = cron
8265

8366
- stage: baseline
84-
# Coverage for:
85-
# - _pytest.unittest._handle_skip (via pexpect).
86-
env: TOXENV=py27-pexpect,py27-twisted PYTEST_COVERAGE=1
87-
python: '2.7'
88-
# Use py36 here for faster baseline.
89-
- env: TOXENV=py36-xdist
67+
env: TOXENV=py36-xdist
9068
python: '3.6'
9169
- env: TOXENV=linting,docs,doctesting PYTEST_COVERAGE=1
9270
cache:

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Features
8585
- Can run `unittest <https://docs.pytest.org/en/latest/unittest.html>`_ (or trial),
8686
`nose <https://docs.pytest.org/en/latest/nose.html>`_ test suites out of the box;
8787

88-
- Python 2.7, Python 3.4+, PyPy 2.3, Jython 2.5 (untested);
88+
- Python 3.5+ and PyPy3;
8989

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

azure-pipelines.yml

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ trigger:
44

55
variables:
66
PYTEST_ADDOPTS: "--junitxml=build/test-results/$(tox.env).xml -vv"
7-
python.needs_vc: False
87
COVERAGE_FILE: "$(Build.Repository.LocalPath)/.coverage"
98
COVERAGE_PROCESS_START: "$(Build.Repository.LocalPath)/.coveragerc"
109
PYTEST_COVERAGE: '0'
@@ -16,44 +15,10 @@ jobs:
1615
vmImage: "vs2017-win2016"
1716
strategy:
1817
matrix:
19-
py27:
20-
python.version: '2.7'
21-
tox.env: 'py27'
22-
py27-nobyte-lsof-numpy:
23-
python.version: '2.7'
24-
tox.env: 'py27-lsof-nobyte-numpy'
25-
# Coverage for:
26-
# - test_supports_breakpoint_module_global
27-
# - test_terminal_reporter_writer_attr (without xdist)
28-
# - "if write" branch in _pytest.assertion.rewrite
29-
# - numpy
30-
# - pytester's LsofFdLeakChecker (being skipped)
31-
PYTEST_COVERAGE: '1'
32-
py27-twisted:
33-
python.version: '2.7'
34-
tox.env: 'py27-twisted'
35-
python.needs_vc: True
36-
py27-pluggymaster-xdist:
37-
python.version: '2.7'
38-
tox.env: 'py27-pluggymaster-xdist'
39-
# Coverage for:
40-
# - except-IOError in _attempt_to_close_capture_file for py2.
41-
# Also seen with py27-nobyte (using xdist), and py27-xdist.
42-
# But no exception with py27-pexpect,py27-twisted,py27-numpy.
43-
PYTEST_COVERAGE: '1'
44-
# -- pypy2 and pypy3 are disabled for now: #5279 --
45-
# pypy:
46-
# python.version: 'pypy2'
47-
# tox.env: 'pypy'
18+
# -- pypy3 disabled for now: #5279 --
4819
# pypy3:
4920
# python.version: 'pypy3'
5021
# tox.env: 'pypy3'
51-
py34-xdist:
52-
python.version: '3.4'
53-
tox.env: 'py34-xdist'
54-
# Coverage for:
55-
# - _pytest.compat._bytes_to_ascii
56-
PYTEST_COVERAGE: '1'
5722
py35-xdist:
5823
python.version: '3.5'
5924
tox.env: 'py35-xdist'
@@ -87,10 +52,6 @@ jobs:
8752
versionSpec: '$(python.version)'
8853
architecture: 'x64'
8954

90-
- script: choco install vcpython27
91-
condition: eq(variables['python.needs_vc'], True)
92-
displayName: 'Install VC for py27'
93-
9455
- script: python -m pip install --upgrade pip && python -m pip install tox
9556
displayName: 'Install tox'
9657

doc/en/_templates/globaltoc.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ <h3><a href="{{ pathto(master_doc) }}">{{ _('Table Of Contents') }}</a></h3>
1010
<li><a href="{{ pathto('changelog') }}">Changelog</a></li>
1111
<li><a href="{{ pathto('contributing') }}">Contributing</a></li>
1212
<li><a href="{{ pathto('backwards-compatibility') }}">Backwards Compatibility</a></li>
13+
<li><a href="{{ pathto('py27-py34-deprecation') }}">Python 2.7 and 3.4 Support</a></li>
1314
<li><a href="{{ pathto('license') }}">License</a></li>
1415
<li><a href="{{ pathto('contact') }}">Contact Channels</a></li>
1516
</ul>

doc/en/example/markers.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,7 @@ its test methods:
288288
This is equivalent to directly applying the decorator to the
289289
two test functions.
290290

291-
To remain backward-compatible with Python 2.4 you can also set a
292-
``pytestmark`` attribute on a TestClass like this:
291+
Due to legacy reasons, it is possible to set the ``pytestmark`` attribute on a TestClass like this:
293292

294293
.. code-block:: python
295294

doc/en/getting-started.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Installation and Getting Started
22
===================================
33

4-
**Pythons**: Python 2.7, 3.4, 3.5, 3.6, 3.7, Jython, PyPy-2.3
4+
**Pythons**: Python 3.5, 3.6, 3.7, PyPy3
55

6-
**Platforms**: Unix/Posix and Windows
6+
**Platforms**: Linux and Windows
77

88
**PyPI package name**: `pytest <https://pypi.org/project/pytest/>`_
99

doc/en/goodpractices.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ Good Integration Practices
77
Install package with pip
88
-------------------------------------------------
99

10-
For development, we recommend you use venv_ for virtual environments
11-
(or virtualenv_ for Python 2.7) and
10+
For development, we recommend you use venv_ for virtual environments and
1211
pip_ for installing your application and any dependencies,
1312
as well as the ``pytest`` package itself.
1413
This ensures your code and dependencies are isolated from your system Python installation.

doc/en/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Features
6161

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

64-
- Python 2.7, Python 3.4+, PyPy 2.3, Jython 2.5 (untested);
64+
- Python Python 3.5+ and PyPy 3;
6565

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

setup.cfg

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ classifiers =
2323
Topic :: Software Development :: Testing
2424
Topic :: Software Development :: Libraries
2525
Topic :: Utilities
26-
Programming Language :: Python :: 2
27-
Programming Language :: Python :: 2.7
28-
Programming Language :: Python :: 3
29-
Programming Language :: Python :: 3.4
26+
Programming Language :: Python :: 3 :: Only
3027
Programming Language :: Python :: 3.5
3128
Programming Language :: Python :: 3.6
3229
Programming Language :: Python :: 3.7
30+
Programming Language :: Python :: 3.8
3331
platforms = unix, linux, osx, cygwin, win32
3432

3533
[options]
@@ -43,7 +41,7 @@ packages =
4341
_pytest.mark
4442

4543
py_modules = pytest
46-
python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
44+
python_requires = >=3.5
4745

4846

4947
[options.entry_points]

setup.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,8 @@
88
"six>=1.10.0",
99
"packaging",
1010
"attrs>=17.4.0",
11-
'more-itertools>=4.0.0,<6.0.0;python_version<="2.7"',
12-
'more-itertools>=4.0.0;python_version>"2.7"',
11+
"more-itertools>=4.0.0",
1312
"atomicwrites>=1.0",
14-
'funcsigs>=1.0;python_version<"3.0"',
1513
'pathlib2>=2.2.0;python_version<"3.6"',
1614
'colorama;sys_platform=="win32"',
1715
"pluggy>=0.12,<1.0",
@@ -30,9 +28,9 @@ def main():
3028
"testing": [
3129
"argcomplete",
3230
"hypothesis>=3.56",
31+
"mock",
3332
"nose",
3433
"requests",
35-
"mock;python_version=='2.7'",
3634
],
3735
},
3836
# fmt: on

0 commit comments

Comments
 (0)