Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 1c9f4d7

Browse files
committedDec 30, 2019
Delete Python2-only tests
1 parent ec8e02b commit 1c9f4d7

15 files changed

+10
-397
lines changed
 

‎.flake8

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ exclude =
55
hypothesis-python/src/hypothesis/vendor/*,
66
test_reflection.py,
77
test_imports.py,
8-
hypothesis-python/tests/py2/*,
98
test_lambda_formatting.py
109
ignore =
1110
# `black` creates these ones

‎azure-pipelines.yml

-36
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,12 @@ jobs:
1818
TASK: check-coverage
1919
check-conjecture-coverage:
2020
TASK: check-conjecture-coverage
21-
check-pypy:
22-
TASK: check-pypy
2321
check-pypy35:
2422
TASK: check-pypy35
2523
check-pypy36:
2624
TASK: check-pypy36
2725
check-py36:
2826
TASK: check-py36
29-
check-py27:
30-
TASK: check-py27
3127
check-py35:
3228
TASK: check-py35
3329
check-py37:
@@ -73,39 +69,11 @@ jobs:
7369
pytest
7470
displayName: Run tests
7571
76-
- job: windows_py2
77-
pool:
78-
vmImage: 'windows-2019'
79-
strategy:
80-
matrix:
81-
check-py27-x64:
82-
python.version: '2.7'
83-
python.architecture: 'x64'
84-
check-py27-x86:
85-
python.version: '2.7'
86-
python.architecture: 'x86'
87-
steps:
88-
- task: UsePythonVersion@0
89-
inputs:
90-
versionSpec: '$(python.version)'
91-
architecture: '$(python.architecture)'
92-
- script: |
93-
pip install --upgrade setuptools pip wheel
94-
pip install setuptools -r requirements/py2.txt
95-
pip install hypothesis-python/[all]
96-
displayName: Install dependencies
97-
- script: |
98-
cd hypothesis-python
99-
pytest tests\cover tests/datetime tests\numpy tests\pandas tests\py3 tests\pytest
100-
displayName: Run tests
101-
10272
- job: osx
10373
pool:
10474
vmImage: 'macOS-10.13'
10575
strategy:
10676
matrix:
107-
check-py27:
108-
TASK: check-py27
10977
check-py36:
11078
TASK: check-py36
11179
steps:
@@ -127,10 +95,6 @@ jobs:
12795
vmImage: 'Ubuntu 16.04'
12896
strategy:
12997
matrix:
130-
check-unicode:
131-
TASK: check-unicode
132-
check-py27-typing:
133-
TASK: check-py27-typing
13498
check-nose:
13599
TASK: check-nose
136100
check-pytest43:

‎hypothesis-python/scripts/basic-test.sh

+2-6
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ pip install .
1616
PYTEST="python -m pytest -n2"
1717

1818
# Run all the no-extra-dependency tests for this version (except slow nocover tests)
19-
if [ "$(python -c 'import sys; print(sys.version_info[0] == 2)')" = "True" ] ; then
20-
$PYTEST tests/cover tests/pytest tests/py2
21-
else
22-
$PYTEST tests/cover tests/pytest tests/py3
23-
fi
19+
$PYTEST tests/cover tests/pytest tests/py3
2420

2521
# Run tests for each extra module while the requirements are installed
2622
pip install ".[pytz, dateutil]"
@@ -37,7 +33,7 @@ pip install lark-parser==0.7.1
3733
$PYTEST tests/lark/
3834
pip uninstall -y lark-parser
3935

40-
if [ "$(python -c 'import sys; print(sys.version_info[:2] in ((2, 7), (3, 6)))')" = "False" ] ; then
36+
if [ "$(python -c 'import sys; print(sys.version_info[:2] == (3, 6))')" = "False" ] ; then
4137
exit 0
4238
fi
4339

‎hypothesis-python/scripts/unicodechecker.py

-53
This file was deleted.

‎hypothesis-python/tests/README.rst

-4
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,6 @@ Still here? Here's a note on what to expect in each directory.
102102
``pandas/``
103103
Tests for the Pandas extra.
104104

105-
``py2/``
106-
Tests that require Python 2. This is a small group, because almost all
107-
of our code and tests are also compatible with Python 3.
108-
109105
``py3/``
110106
Tests that require Python 3. Includes checking that unicode identifiers
111107
and function annotations don't break anything, asyncio tests, and tests

‎hypothesis-python/tests/conftest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
run()
3232

3333
# Skip collection of tests which require the Django test runner,
34-
# or that don't work on the current major version of Python.
35-
collect_ignore_glob = ["django/*", "py3/*" if sys.version_info[0] == 2 else "py2/*"]
34+
# or that don't work on the current version of Python.
35+
collect_ignore_glob = ["django/*"]
3636
if sys.version_info < (3, 8):
3737
collect_ignore_glob.append("py3/*py38*")
3838

‎hypothesis-python/tests/py2/__init__.py

-18
This file was deleted.

‎hypothesis-python/tests/py2/test_destructuring.py

-40
This file was deleted.

‎hypothesis-python/tests/py2/test_from_type.py

-39
This file was deleted.

‎hypothesis-python/tests/py2/test_generate_ints.py

-29
This file was deleted.

‎hypothesis-python/tests/py2/test_validation.py

-33
This file was deleted.

‎hypothesis-python/tox.ini

-59
Original file line numberDiff line numberDiff line change
@@ -20,54 +20,12 @@ commands =
2020
prettyquick: python -m pytest tests/cover/
2121
custom: python -m pytest {posargs}
2222

23-
[testenv:py27-full]
24-
deps =
25-
-r../requirements/py2.txt
26-
whitelist_externals=
27-
bash
28-
commands =
29-
bash scripts/basic-test.sh
30-
31-
[testenv:pypy-full]
32-
deps =
33-
-r../requirements/py2.txt
34-
whitelist_externals=
35-
bash
36-
commands =
37-
bash scripts/basic-test.sh
38-
3923
[testenv:quality]
4024
deps=
4125
-r../requirements/test.txt
4226
commands=
4327
python -m pytest tests/quality/ -n2
4428

45-
46-
[testenv:quality2]
47-
basepython=python2.7
48-
deps=
49-
-r../requirements/py2.txt
50-
commands=
51-
python -m pytest tests/quality/
52-
53-
[testenv:py27typing]
54-
basepython=python2.7
55-
deps=
56-
-r../requirements/py2.txt
57-
-r../requirements/typing.txt
58-
commands=
59-
python -m pytest tests/cover/ -n2
60-
61-
[testenv:unicode]
62-
basepython=python2.7
63-
deps =
64-
unicode-nazi
65-
setenv=
66-
UNICODENAZI=true
67-
PYTHONPATH=.
68-
commands=
69-
python scripts/unicodechecker.py
70-
7129
[testenv:pandas19]
7230
deps =
7331
-r../requirements/test.txt
@@ -180,26 +138,9 @@ commands =
180138
python -m coverage run --rcfile=.coveragerc --source=hypothesis.internal.conjecture -m pytest -n0 --strict tests/conjecture
181139
python -m coverage report -m --fail-under=100 --show-missing --skip-covered
182140

183-
[testenv:pypy-with-tracer]
184-
setenv=
185-
HYPOTHESIS_PROFILE=with_coverage
186-
basepython=pypy
187-
deps =
188-
-r../requirements/py2.txt
189-
commands =
190-
python -m pytest tests/cover/test_testdecorators.py tests/nocover/test_coverage.py -n 0 {posargs}
191-
192141

193142
[testenv:examples3]
194143
deps=
195144
-r../requirements/test.txt
196145
commands=
197146
python -m pytest examples
198-
199-
200-
[testenv:examples2]
201-
basepython=python2.7
202-
deps=
203-
-r../requirements/py2.txt
204-
commands=
205-
python -m pytest examples

‎requirements/py2.txt

-25
This file was deleted.

‎scripts/run_with_env.cmd

+3-17
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of:
33
:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1)
44
::
5-
:: To build extensions for 64 bit Python 2, we need to configure environment
6-
:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of:
7-
:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0)
8-
::
95
:: 32 bit builds do not require specific environment configurations.
106
::
117
:: Note: this script needs to be run with the /E:ON and /V:ON flags for the
@@ -22,22 +18,12 @@
2218
SET COMMAND_TO_RUN=%*
2319
SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows
2420

25-
SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%"
26-
IF %MAJOR_PYTHON_VERSION% == "2" (
27-
SET WINDOWS_SDK_VERSION="v7.0"
28-
) ELSE IF %MAJOR_PYTHON_VERSION% == "3" (
29-
SET WINDOWS_SDK_VERSION="v7.1"
30-
) ELSE (
31-
ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%"
32-
EXIT 1
33-
)
34-
3521
IF "%PYTHON_ARCH%"=="64" (
36-
ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture
22+
ECHO Configuring Windows SDK v7.1 for Python 3 on a 64 bit architecture
3723
SET DISTUTILS_USE_SDK=1
3824
SET MSSdk=1
39-
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION%
40-
"%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release
25+
"%WIN_SDK_ROOT%\v7.1\Setup\WindowsSdkVer.exe" -q -version:v7.1
26+
"%WIN_SDK_ROOT%\v7.1\Bin\SetEnv.cmd" /x64 /release
4127
ECHO Executing: %COMMAND_TO_RUN%
4228
call %COMMAND_TO_RUN% || EXIT 1
4329
) ELSE (

‎tooling/src/hypothesistooling/__main__.py

+3-35
Original file line numberDiff line numberDiff line change
@@ -368,25 +368,23 @@ def run_tox(task, version):
368368

369369

370370
# Via https://github.com/pyenv/pyenv/tree/master/plugins/python-build/share/python-build
371-
PY27 = "2.7.16"
372371
PY35 = "3.5.7"
373372
PY36 = "3.6.9"
374373
PY37 = "3.7.4"
375374
PY38 = "3.8.0"
376-
PYPY2 = "pypy2.7-5.10.0"
377375
PYPY35 = "pypy3.5-7.0.0"
378376
PYPY36 = "pypy3.6-7.1.1"
379377

380378

381379
@task()
382380
def install_core():
383-
install.python_executable(PY27)
384381
install.python_executable(PY36)
385382

386383

387-
ALIASES = {PYPY2: "pypy", PYPY35: "pypy3", PYPY36: "pypy3"}
384+
# ALIASES are the executable names for each Python version
385+
ALIASES = {PYPY35: "pypy3", PYPY36: "pypy3"}
388386

389-
for n in [PY27, PY35, PY36, PY37, PY38]:
387+
for n in [PY35, PY36, PY37, PY38]:
390388
major, minor, patch = n.split(".")
391389
ALIASES[n] = "python%s.%s" % (major, minor)
392390

@@ -400,11 +398,6 @@ def install_core():
400398
)
401399

402400

403-
@python_tests
404-
def check_py27():
405-
run_tox("py27-full", PY27)
406-
407-
408401
@python_tests
409402
def check_py35():
410403
run_tox("py35-full", PY35)
@@ -425,11 +418,6 @@ def check_py38():
425418
run_tox("py38-full", PY38)
426419

427420

428-
@python_tests
429-
def check_pypy():
430-
run_tox("pypy-full", PYPY2)
431-
432-
433421
@python_tests
434422
def check_pypy35():
435423
run_tox("pypy3-full", PYPY35)
@@ -440,16 +428,6 @@ def check_pypy36():
440428
run_tox("pypy3-full", PYPY36)
441429

442430

443-
@python_tests
444-
def check_py27_typing():
445-
run_tox("py27typing", PY27)
446-
447-
448-
@python_tests
449-
def check_pypy_with_tracer():
450-
run_tox("pypy-with-tracer", PYPY2)
451-
452-
453431
def standard_tox_task(name):
454432
TASKS["check-" + name] = python_tests(lambda: run_tox(name, PY36))
455433

@@ -476,21 +454,11 @@ def check_quality():
476454
)
477455

478456

479-
@examples_task
480-
def check_examples2():
481-
run_tox("examples2", PY27)
482-
483-
484457
@examples_task
485458
def check_examples3():
486459
run_tox("examples3", PY36)
487460

488461

489-
@python_tests
490-
def check_unicode():
491-
run_tox("unicode", PY27)
492-
493-
494462
@task()
495463
def check_whole_repo_tests():
496464
install.ensure_shellcheck()

0 commit comments

Comments
 (0)
Please sign in to comment.