Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbernat committed Oct 4, 2020
1 parent b518ff7 commit 3e2740b
Show file tree
Hide file tree
Showing 12 changed files with 26 additions and 16 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ jobs:
- 3.7
- 3.6
- 3.5
- 3.4
- pypy3
- 2.7
- pypy2
include:
- { os: MacOs, py: brew@py3 }
- { os: macos, py: brew@py3 }
- { os: ubuntu, py: 3.4.10 }
steps:
- name: Install OS dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion docs/changelog/1962.bugfix.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Fix Nonetype error in cygwin if POSIX path in dest - by :user:`danyeaw`.
Fix ``None`` type error in cygwin if POSIX path in dest - by :user:`danyeaw`.
1 change: 1 addition & 0 deletions docs/changelog/1963.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix Python 3.4 incompatibilities (added back to the CI) - by :user:`gaborbernat`.
4 changes: 1 addition & 3 deletions src/virtualenv/seed/embed/via_app_data/via_app_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
from subprocess import CalledProcessError
from threading import Lock, Thread

import six

from virtualenv.info import fs_supports_symlink
from virtualenv.seed.embed.base_embed import BaseEmbed
from virtualenv.seed.wheels import get_wheel
Expand Down Expand Up @@ -104,7 +102,7 @@ def _get(distribution, version):
if version is not None:
msg += " version {}".format(version)
msg += ", pip download exit code {}".format(failure.returncode)
output = failure.output if six.PY2 else (failure.output + failure.stderr)
output = failure.output if sys.version_info < (3, 5) else (failure.output + failure.stderr)
if output:
msg += "\n"
msg += output
Expand Down
8 changes: 5 additions & 3 deletions src/virtualenv/util/path/_pathlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@ def write_bytes(self, data):
return f.write(view)

def mkdir(self, mode=0o777, parents=False, exist_ok=False):
if exist_ok and self.exists():
return
super(type(BuiltinPath()), self).mkdir(mode, parents)
try:
super(type(BuiltinPath()), self).mkdir(mode, parents)
except FileExistsError as exception:
if not exist_ok:
raise exception


else:
Expand Down
2 changes: 1 addition & 1 deletion tasks/__main__zipapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import zipfile

ABS_HERE = os.path.abspath(os.path.dirname(__file__))
NEW_IMPORT_SYSTEM = sys.version_info[0:2] > (3, 4)
NEW_IMPORT_SYSTEM = sys.version_info[0] == 3


class VersionPlatformSelect(object):
Expand Down
7 changes: 5 additions & 2 deletions tests/integration/test_run_int.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
from __future__ import absolute_import, unicode_literals

import sys

from virtualenv import cli_run
from virtualenv.util.six import ensure_text
from virtualenv.util.subprocess import run_cmd


def test_app_data_pinning(tmp_path):
result = cli_run([ensure_text(str(tmp_path)), "--pip", "19.3.1", "--activators", "", "--seeder", "app-data"])
version = "19.1.1" if sys.version_info[0:2] == (3, 4) else "19.3.1"
result = cli_run([ensure_text(str(tmp_path)), "--pip", version, "--activators", "", "--seeder", "app-data"])
code, out, err = run_cmd([str(result.creator.script("pip")), "list", "--disable-pip-version-check"])
assert not code
assert not err
for line in out.splitlines():
parts = line.split()
if parts and parts[0] == "pip":
assert parts[1] == "19.3.1"
assert parts[1] == version
break
else:
assert not out
2 changes: 2 additions & 0 deletions tests/unit/create/test_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ def system(session_app_data):
ids=lambda i: "-".join(i) if isinstance(i, tuple) else i,
)
def test_create_no_seed(python, creator, isolated, system, coverage_env, special_name_dir):
if creator[0] == "venv" and sys.version_info[0:2] == (3, 4): # venv on python3.4 only supports ascii chars
special_name_dir = special_name_dir.with_name(special_name_dir.name.encode("ascii", errors="ignore").decode())
dest = special_name_dir
creator_key, method = creator
cmd = [
Expand Down
1 change: 1 addition & 0 deletions tests/unit/seed/embed/test_boostrap_link_via_app_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def test_seed_link_via_app_data(tmp_path, coverage_env, current_fastest, copies)
bundle_ver = BUNDLE_SUPPORT[current.version_release_str]
create_cmd = [
ensure_text(str(tmp_path / "en v")), # space in the name to ensure generated scripts work when path has space
"--no-periodic-update",
"--seeder",
"app-data",
"--extra-search-dir",
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/seed/embed/test_pip_invoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def _execute(cmd, env):
expected_list = list(
itertools.chain.from_iterable(["--find-links", str(e)] for e in sorted(expected, key=lambda x: str(x))),
)
found = cmd[-len(expected_list) :]
found = cmd[-len(expected_list) :] if expected_list else []
assert "--no-index" not in cmd
cmd.append("--no-index")
assert found == expected_list
Expand Down
3 changes: 2 additions & 1 deletion tests/unit/seed/wheels/test_periodic_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ def _do_update(distribution, for_py_version, embed_filename, app_data, search_di

assert "upgrade pip" in caplog.text
assert "upgraded pip" in caplog.text
assert " new entries found:\n\tNewVersion" in caplog.text
assert " no new versions found" in caplog.text
assert " new entries found:\n" in caplog.text
assert "\tNewVersion(" in caplog.text
packages = defaultdict(list)
for i in do_update_mock.call_args_list:
packages[i[1]["distribution"]].append(i[1]["for_py_version"])
Expand Down
6 changes: 4 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ setenv =
PYTHONIOENCODING = utf-8
_COVERAGE_SRC = {envsitepackagesdir}/virtualenv
{py34,py27,pypy, upgrade}: PYTHONWARNINGS = ignore:DEPRECATION::pip._internal.cli.base_command
{pypy,py27}: PYTEST_XDIST = 0
{py34,pypy,py27}: PYTEST_XDIST = 0
extras =
testing
commands =
Expand All @@ -44,7 +44,9 @@ commands =
python -m coverage combine
python -m coverage report --skip-covered --show-missing
python -m coverage xml -o {toxworkdir}/coverage.{envname}.xml
python -m coverage html -d {envtmpdir}/htmlcov --title virtualenv-{envname}-coverage
python -m coverage html -d {envtmpdir}/htmlcov \
!py34: --show-contexts \
--title virtualenv-{envname}-coverage
install_command = python -m pip install {opts} {packages} --disable-pip-version-check

[testenv:fix_lint]
Expand Down

0 comments on commit 3e2740b

Please sign in to comment.