Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable pyenv interpreter tests under pypy. #859

Merged
merged 1 commit into from
Jan 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 22 additions & 31 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,6 @@
x-pyenv-shard: &x-pyenv-shard
language: generic
env: &env >
PYENV_ROOT="${HOME}/.pyenv_pex"
PATH="${PYENV_ROOT}/shims:${PATH}"
cache: &cache
# The default is 3 minutes (180).
timeout: 300
directories:
- .pyenv_test
- "${PYENV_ROOT}"
install: |
PYENV="${PYENV_ROOT}/bin/pyenv"
if [ ! -x "${PYENV}" ]; then
rm -rf ${PYENV_ROOT}
git clone https://github.com/pyenv/pyenv "${PYENV_ROOT}";
fi
"${PYENV}" install --keep --skip-existing ${PYENV_VERSION}
"${PYENV}" global ${PYENV_VERSION}
pip install -U tox

x-py27: &x-py27 PYENV_VERSION=2.7.17

x-py38: &x-py38 PYENV_VERSION=3.8.0

x-pypy: &x-pypy PYENV_VERSION=pypy2.7-7.2.0

x-linux-shard: &x-linux-shard
os: linux
dist: bionic
dist: bionic
language: python
install: |
pip install -U tox
Expand All @@ -45,9 +18,27 @@ x-linux-38-shard: &x-linux-38-shard
python: 3.8

x-osx-shard: &x-osx-shard
<<: *x-pyenv-shard
os: osx
osx_image: xcode9.4
language: generic
env: &env >
PYENV_ROOT="${HOME}/.pyenv_pex"
PATH="${PYENV_ROOT}/shims:${PATH}"
cache:
# The default is 3 minutes (180).
timeout: 300
directories:
- .pyenv_test
- "${PYENV_ROOT}"
install: |
PYENV="${PYENV_ROOT}/bin/pyenv"
if [ ! -x "${PYENV}" ]; then
rm -rf ${PYENV_ROOT}
git clone https://github.com/pyenv/pyenv "${PYENV_ROOT}";
fi
"${PYENV}" install --keep --skip-existing ${PYENV_VERSION}
"${PYENV}" global ${PYENV_VERSION}
pip install -U tox

x-osx-ssl: &x-osx-ssl >
CPPFLAGS=-I/usr/local/opt/openssl/include
Expand All @@ -57,15 +48,15 @@ x-osx-27-shard: &x-osx-27-shard
<<: *x-osx-shard
env:
- *env
- *x-py27
- *x-osx-ssl
- PYENV_VERSION=2.7.17

x-osx-38-shard: &x-osx-38-shard
<<: *x-osx-shard
env:
- *env
- *x-py38
- *x-osx-ssl
- PYENV_VERSION=3.8.0

# NB: Travis partitions caches using a combination of os, language amd env vars. As such, we do not
# use TOXENV and instead pass the toxenv via -e on the command line. This helps ensure we share
Expand Down
9 changes: 0 additions & 9 deletions pex/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from collections import namedtuple
from textwrap import dedent

import pytest

from pex.common import open_zip, safe_mkdir, safe_mkdtemp, safe_rmtree, temporary_dir, touch
from pex.compatibility import PY3, nested
from pex.distribution_target import DistributionTarget
Expand All @@ -35,13 +33,6 @@
NOT_CPYTHON36_OR_LINUX = NOT_CPYTHON36 or IS_LINUX


skip_for_pyenv_use_under_pypy = pytest.mark.skipif(
IS_PYPY,
reason='Our pyenv interpreter setup fails under pypy: '
'https://github.com/pantsbuild/pex/issues/477'
)


@contextlib.contextmanager
def temporary_filename():
"""Creates a temporary filename.
Expand Down
27 changes: 5 additions & 22 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from pex.pex_info import PexInfo
from pex.pip import get_pip
from pex.testing import (
IS_PYPY,
NOT_CPYTHON27,
NOT_CPYTHON27_OR_OSX,
NOT_CPYTHON36_OR_LINUX,
Expand All @@ -34,7 +35,6 @@
run_pex_command,
run_simple_pex,
run_simple_pex_test,
skip_for_pyenv_use_under_pypy,
temporary_content
)
from pex.third_party import pkg_resources
Expand Down Expand Up @@ -351,7 +351,6 @@ def test_interpreter_constraints_to_pex_info_py2():
assert {'>=2.7,<3', '>=3.5'} == set(pex_info.interpreter_constraints)


@skip_for_pyenv_use_under_pypy
def test_interpreter_constraints_to_pex_info_py3():
py3_interpreter = ensure_python_interpreter(PY36)
with temporary_dir() as output_dir:
Expand Down Expand Up @@ -391,7 +390,6 @@ def test_interpreter_resolution_with_multiple_constraint_options():
assert pex_info.build_properties['version'][0] < 3


@skip_for_pyenv_use_under_pypy
def test_interpreter_resolution_with_pex_python_path():
with temporary_dir() as td:
pexrc_path = os.path.join(td, '.pexrc')
Expand Down Expand Up @@ -425,7 +423,6 @@ def test_interpreter_resolution_with_pex_python_path():
assert str(pex_python_path.split(':')[0]).encode() in stdout


@skip_for_pyenv_use_under_pypy
def test_interpreter_constraints_honored_without_ppp_or_pp():
# Create a pex with interpreter constraints, but for not the default interpreter in the path.
with temporary_dir() as td:
Expand Down Expand Up @@ -459,7 +456,6 @@ def test_interpreter_constraints_honored_without_ppp_or_pp():
assert str(py36_path).encode() in stdout


@skip_for_pyenv_use_under_pypy
def test_interpreter_resolution_pex_python_path_precedence_over_pex_python():
with temporary_dir() as td:
pexrc_path = os.path.join(td, '.pexrc')
Expand Down Expand Up @@ -507,7 +503,6 @@ def test_plain_pex_exec_no_ppp_no_pp_no_constraints():
assert os.path.realpath(sys.executable).encode() in stdout


@skip_for_pyenv_use_under_pypy
def test_pex_exec_with_pex_python_path_only():
with temporary_dir() as td:
pexrc_path = os.path.join(td, '.pexrc')
Expand All @@ -533,7 +528,6 @@ def test_pex_exec_with_pex_python_path_only():
assert str(pex_python_path.split(':')[0]).encode() in stdout


@skip_for_pyenv_use_under_pypy
def test_pex_exec_with_pex_python_path_and_pex_python_but_no_constraints():
with temporary_dir() as td:
pexrc_path = os.path.join(td, '.pexrc')
Expand Down Expand Up @@ -561,7 +555,6 @@ def test_pex_exec_with_pex_python_path_and_pex_python_but_no_constraints():
assert str(pex_python_path.split(':')[0]).encode() in stdout


@skip_for_pyenv_use_under_pypy
def test_pex_python():
py2_path_interpreter = ensure_python_interpreter(PY27)
py3_path_interpreter = ensure_python_interpreter(PY36)
Expand Down Expand Up @@ -622,7 +615,6 @@ def test_pex_python():
assert correct_interpreter_path in stdout


@skip_for_pyenv_use_under_pypy
def test_entry_point_targeting():
"""Test bugfix for https://github.com/pantsbuild/pex/issues/434"""
with temporary_dir() as td:
Expand All @@ -643,7 +635,6 @@ def test_entry_point_targeting():
assert 'usage: autopep8'.encode() in stdout


@skip_for_pyenv_use_under_pypy
def test_interpreter_selection_using_os_environ_for_bootstrap_reexec():
"""
This is a test for verifying the proper function of the
Expand Down Expand Up @@ -833,7 +824,6 @@ def ensure_failure(req_name, req_version, platform, extra_flags):
yield test_resolve, ensure_failure


@skip_for_pyenv_use_under_pypy
def test_pex_manylinux_and_tag_selection_linux_msgpack():
"""Tests resolver manylinux support and tag targeting."""
with pex_manylinux_and_tag_selection_context() as (test_resolve, ensure_failure):
Expand Down Expand Up @@ -983,7 +973,6 @@ def test_pex_resource_bundling():
assert stdout == b'hello\n'


@skip_for_pyenv_use_under_pypy
def test_entry_point_verification_3rdparty():
with temporary_dir() as td:
pex_out_path = os.path.join(td, 'pex.pex')
Expand All @@ -994,7 +983,6 @@ def test_entry_point_verification_3rdparty():
res.assert_success()


@skip_for_pyenv_use_under_pypy
def test_invalid_entry_point_verification_3rdparty():
with temporary_dir() as td:
pex_out_path = os.path.join(td, 'pex.pex')
Expand All @@ -1005,7 +993,6 @@ def test_invalid_entry_point_verification_3rdparty():
res.assert_failure()


@skip_for_pyenv_use_under_pypy
def test_multiplatform_entrypoint():
with temporary_dir() as td:
pex_out_path = os.path.join(td, 'p537.pex')
Expand Down Expand Up @@ -1087,7 +1074,6 @@ def test_pex_interpreter_interact_custom_setuptools_useable():
assert rc == 0, stdout


@skip_for_pyenv_use_under_pypy
def test_setup_python():
interpreter = ensure_python_interpreter(PY27)
with temporary_dir() as out:
Expand All @@ -1100,7 +1086,6 @@ def test_setup_python():
subprocess.check_call([pex, '-c', 'import jsonschema'])


@skip_for_pyenv_use_under_pypy
def test_setup_interpreter_constraint():
interpreter = ensure_python_interpreter(PY27)
with temporary_dir() as out:
Expand All @@ -1120,7 +1105,6 @@ def test_setup_interpreter_constraint():
assert rc == 0


@skip_for_pyenv_use_under_pypy
def test_setup_python_multiple_transitive_markers():
py27_interpreter = ensure_python_interpreter(PY27)
py36_interpreter = ensure_python_interpreter(PY36)
Expand Down Expand Up @@ -1154,7 +1138,6 @@ def test_setup_python_multiple_transitive_markers():
assert to_bytes(os.path.realpath(py36_interpreter)) == stdout.strip()


@skip_for_pyenv_use_under_pypy
def test_setup_python_direct_markers():
py36_interpreter = ensure_python_interpreter(PY36)
with temporary_dir() as out:
Expand All @@ -1172,7 +1155,6 @@ def test_setup_python_direct_markers():
subprocess.check_call(py2_only_program, env=make_env(PATH=os.path.dirname(py36_interpreter)))


@skip_for_pyenv_use_under_pypy
def test_setup_python_multiple_direct_markers():
py36_interpreter = ensure_python_interpreter(PY36)
py27_interpreter = ensure_python_interpreter(PY27)
Expand Down Expand Up @@ -1318,7 +1300,10 @@ def test_pkg_resource_early_import_on_pex_path():
assert return_code == 0


@skip_for_pyenv_use_under_pypy
@pytest.mark.skipif(IS_PYPY,
reason="The cryptography 2.6.1 project only has pre-built wheels for CPython "
"available on PyPI and this test relies upon a pre-built wheel being "
"available.")
def test_issues_539_abi3_resolution():
# The cryptography team releases the following relevant pre-built wheels for version 2.6.1:
# cryptography-2.6.1-cp27-cp27m-macosx_10_6_intel.whl
Expand Down Expand Up @@ -1549,7 +1534,6 @@ def test_pex_reexec_constraints_dont_match_current_pex_python():
interpreter_constraints=['=={}'.format(version)])


@skip_for_pyenv_use_under_pypy
def test_issues_745_extras_isolation():
# Here we ensure one of our extras, `subprocess32`, is properly isolated in the transition from
# pex bootstrapping where it is imported by `pex.executor` to execution of user code.
Expand Down Expand Up @@ -1591,7 +1575,6 @@ def test_issues_745_extras_isolation():
assert subprocess32_location.startswith(pex_root)


@skip_for_pyenv_use_under_pypy
def test_trusted_host_handling():
python = ensure_python_interpreter(PY27)
# Since we explicitly ask Pex to find links at http://www.antlr3.org/download/Python, it should
Expand Down
4 changes: 1 addition & 3 deletions tests/test_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from pex import interpreter
from pex.compatibility import PY3
from pex.testing import PY27, PY35, ensure_python_interpreter, skip_for_pyenv_use_under_pypy
from pex.testing import PY27, PY35, ensure_python_interpreter

try:
from mock import patch
Expand Down Expand Up @@ -44,12 +44,10 @@ def test_interpreter1(self):
def test_interpreter2(self):
return ensure_python_interpreter(self.TEST_INTERPRETER2_VERSION)

@skip_for_pyenv_use_under_pypy
def test_interpreter_versioning(self, test_interpreter1):
py_interpreter = interpreter.PythonInterpreter.from_binary(test_interpreter1)
assert py_interpreter.identity.version == self.TEST_INTERPRETER1_VERSION_TUPLE

@skip_for_pyenv_use_under_pypy
def test_interpreter_caching(self, test_interpreter1, test_interpreter2):
py_interpreter1 = interpreter.PythonInterpreter.from_binary(test_interpreter1)
py_interpreter2 = interpreter.PythonInterpreter.from_binary(test_interpreter2)
Expand Down
2 changes: 0 additions & 2 deletions tests/test_pex.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
run_simple_pex,
run_simple_pex_test,
safe_mkdir,
skip_for_pyenv_use_under_pypy,
temporary_content,
write_simple_pex
)
Expand Down Expand Up @@ -479,7 +478,6 @@ def test_pex_verify_entry_point_module_should_fail():
verify_entry_point=True)


@skip_for_pyenv_use_under_pypy
def test_activate_interpreter_different_from_current():
with temporary_dir() as pex_root:
interp_version = PY36 if PY2 else PY27
Expand Down
4 changes: 1 addition & 3 deletions tests/test_pex_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
built_wheel,
ensure_python_interpreter,
run_pex_command,
run_simple_pex,
skip_for_pyenv_use_under_pypy
run_simple_pex
)


Expand Down Expand Up @@ -204,7 +203,6 @@ def assert_run_pex(python=None, pex_args=None):
return results.error.splitlines()


@skip_for_pyenv_use_under_pypy
def test_run_pex():
incompatible_platforms_warning_msg = 'WARNING: attempting to run PEX with incompatible platforms!'

Expand Down
4 changes: 1 addition & 3 deletions tests/test_pex_bootstrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from pex.interpreter import PythonInterpreter
from pex.pex_bootstrapper import iter_compatible_interpreters
from pex.testing import PY27, PY35, PY36, ensure_python_interpreter, skip_for_pyenv_use_under_pypy
from pex.testing import PY27, PY35, PY36, ensure_python_interpreter


def find_interpreters(path, *constraints):
Expand All @@ -15,7 +15,6 @@ def find_interpreters(path, *constraints):
compatibility_constraints=constraints)]


@skip_for_pyenv_use_under_pypy
def test_find_compatible_interpreters():
py27 = ensure_python_interpreter(PY27)
py35 = ensure_python_interpreter(PY35)
Expand All @@ -41,7 +40,6 @@ def test_find_compatible_interpreters():
assert set(interpreters).issubset(all_known_interpreters)


@skip_for_pyenv_use_under_pypy
def test_find_compatible_interpreters_bias_current():
py36 = ensure_python_interpreter(PY36)
assert [os.path.realpath(sys.executable), py36] == find_interpreters([py36, sys.executable])
Expand Down