mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Reformat codes
This commit is contained in:
@@ -1,30 +1,34 @@
|
||||
# -*- coding=utf-8 -*-
|
||||
from __future__ import absolute_import, print_function
|
||||
|
||||
import errno
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import signal
|
||||
import socket
|
||||
import sys
|
||||
import time
|
||||
import warnings
|
||||
|
||||
from shutil import copyfileobj, rmtree as _rmtree
|
||||
from shutil import rmtree as _rmtree
|
||||
|
||||
import pytest
|
||||
import requests
|
||||
|
||||
from pipenv.vendor.vistir.compat import ResourceWarning, fs_str, fs_encode, FileNotFoundError, PermissionError, TemporaryDirectory
|
||||
from pipenv.vendor.vistir.misc import run
|
||||
from pipenv.vendor.vistir.contextmanagers import temp_environ
|
||||
from pipenv.vendor.vistir.path import mkdir_p, create_tracked_tempdir, handle_remove_readonly
|
||||
|
||||
from pipenv._compat import Path
|
||||
from pipenv.exceptions import VirtualenvActivationException
|
||||
from pipenv.vendor import delegator, toml, tomlkit
|
||||
from pytest_pypi.app import prepare_fixtures, prepare_packages as prepare_pypi_packages
|
||||
from pipenv.vendor.vistir.compat import (
|
||||
FileNotFoundError, PermissionError, ResourceWarning, TemporaryDirectory,
|
||||
fs_encode, fs_str
|
||||
)
|
||||
from pipenv.vendor.vistir.contextmanagers import temp_environ
|
||||
from pipenv.vendor.vistir.misc import run
|
||||
from pipenv.vendor.vistir.path import (
|
||||
create_tracked_tempdir, handle_remove_readonly, mkdir_p
|
||||
)
|
||||
from pytest_pypi.app import prepare_fixtures
|
||||
from pytest_pypi.app import prepare_packages as prepare_pypi_packages
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
warnings.simplefilter("default", category=ResourceWarning)
|
||||
@@ -399,7 +403,6 @@ class _PipenvInstance(object):
|
||||
|
||||
def _rmtree_func(path, ignore_errors=True, onerror=None):
|
||||
directory = fs_encode(path)
|
||||
global _rmtree
|
||||
shutil_rmtree = _rmtree
|
||||
if onerror is None:
|
||||
onerror = handle_remove_readonly
|
||||
|
||||
@@ -223,7 +223,7 @@ def test_install_parse_error(PipenvInstance):
|
||||
[dev-packages]
|
||||
""".strip()
|
||||
f.write(contents)
|
||||
c = p.pipenv('install requests u/\\/p@r\$34b13+pkg')
|
||||
c = p.pipenv('install requests u/\\/p@r\\$34b13+pkg')
|
||||
assert c.return_code != 0
|
||||
assert 'u/\\/p@r$34b13+pkg' not in p.pipfile['packages']
|
||||
|
||||
|
||||
@@ -5,9 +5,7 @@ import os
|
||||
import pytest
|
||||
|
||||
from pipenv._compat import Path, TemporaryDirectory
|
||||
from pipenv.project import Project
|
||||
from pipenv.utils import get_windows_path, normalize_drive, temp_environ
|
||||
from pipenv.vendor import delegator
|
||||
from pipenv.utils import normalize_drive, temp_environ
|
||||
|
||||
|
||||
@pytest.mark.dotvenv
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, print_function
|
||||
import os
|
||||
import sys
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@@ -9,7 +9,6 @@ import pytest
|
||||
from flaky import flaky
|
||||
|
||||
from pipenv._compat import Path
|
||||
from pipenv.project import Project
|
||||
from pipenv.utils import mkdir_p, temp_environ
|
||||
from pipenv.vendor import delegator
|
||||
|
||||
@@ -40,7 +39,6 @@ setup(
|
||||
""".strip()
|
||||
fh.write(contents)
|
||||
line = "-e .[dev]"
|
||||
pipfile = {"testpipenv": {"path": ".", "editable": True, "extras": ["dev"]}}
|
||||
with open(os.path.join(p.path, 'Pipfile'), 'w') as fh:
|
||||
fh.write("""
|
||||
[packages]
|
||||
|
||||
@@ -659,4 +659,4 @@ six = "*"
|
||||
c = p.pipenv("lock --clear")
|
||||
assert c.return_code == 0
|
||||
assert "index" in p.lockfile["default"]["six"]
|
||||
assert p.lockfile["default"]["six"]["index"] == "custom", Path(p.lockfile_path).read_text() # p.lockfile["default"]["six"]
|
||||
assert p.lockfile["default"]["six"]["index"] == "custom", Path(p.lockfile_path).read_text() # p.lockfile["default"]["six"]
|
||||
|
||||
@@ -11,7 +11,6 @@ from pipenv.project import Project
|
||||
from pipenv.utils import temp_environ
|
||||
from pipenv.vendor.vistir.path import is_in_path
|
||||
from pipenv.vendor.delegator import run as delegator_run
|
||||
import pipenv.environments
|
||||
|
||||
|
||||
@pytest.mark.project
|
||||
|
||||
@@ -5,7 +5,6 @@ import os
|
||||
import pytest
|
||||
|
||||
from pipenv._compat import Path
|
||||
from pipenv.project import Project
|
||||
|
||||
|
||||
# This module is run only on Windows.
|
||||
|
||||
@@ -4,7 +4,6 @@ import contextlib
|
||||
import io
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
from tarfile import is_tarfile
|
||||
from zipfile import is_zipfile
|
||||
|
||||
@@ -17,5 +17,6 @@ def where():
|
||||
# vendored bundle inside Requests
|
||||
return os.path.join(os.path.abspath(os.path.dirname(__file__)), 'certs', 'cacert.pem')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
print(where())
|
||||
|
||||
@@ -3,6 +3,7 @@ import pytest
|
||||
from .app import app as pypi_app
|
||||
from . import serve, certs
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def pypi(request):
|
||||
server = serve.Server(application=pypi_app)
|
||||
@@ -31,6 +32,7 @@ def pypi_both(request, pypi, pypi_secure):
|
||||
def class_based_pypi(request, pypi):
|
||||
request.cls.pypi = pypi
|
||||
|
||||
|
||||
@pytest.fixture(scope='class')
|
||||
def class_based_pypi_secure(request, pypi_secure):
|
||||
request.cls.pypi_secure = pypi_secure
|
||||
|
||||
@@ -122,6 +122,7 @@ get_extras_links_scenarios = {
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
'scenarios,expected',
|
||||
list(get_extras_links_scenarios.values()),
|
||||
|
||||
@@ -3,11 +3,7 @@ import os
|
||||
|
||||
import pytest
|
||||
|
||||
from first import first
|
||||
from mock import Mock, patch
|
||||
|
||||
import pipenv.utils
|
||||
import pythonfinder.utils
|
||||
from pipenv.exceptions import PipenvUsageError
|
||||
|
||||
|
||||
@@ -129,11 +125,8 @@ def test_convert_deps_to_pip(monkeypatch, deps, expected):
|
||||
),
|
||||
],
|
||||
)
|
||||
def test_convert_deps_to_pip_one_way(monkeypatch, deps, expected):
|
||||
with monkeypatch.context() as m:
|
||||
import pip_shims
|
||||
# m.setattr(pip_shims.shims, "unpack_url", mock_unpack)
|
||||
assert pipenv.utils.convert_deps_to_pip(deps, r=False) == [expected.lower()]
|
||||
def test_convert_deps_to_pip_one_way(deps, expected):
|
||||
assert pipenv.utils.convert_deps_to_pip(deps, r=False) == [expected.lower()]
|
||||
|
||||
|
||||
@pytest.mark.skipif(isinstance(u"", str), reason="don't need to test if unicode is str")
|
||||
@@ -218,7 +211,7 @@ class TestUtils:
|
||||
@pytest.mark.windows
|
||||
@pytest.mark.skipif(os.name != "nt", reason="Windows test only")
|
||||
def test_windows_shellquote(self):
|
||||
test_path = "C:\Program Files\Python36\python.exe"
|
||||
test_path = r"C:\Program Files\Python36\python.exe"
|
||||
expected_path = '"C:\\\\Program Files\\\\Python36\\\\python.exe"'
|
||||
assert pipenv.utils.escape_grouped_arguments(test_path) == expected_path
|
||||
|
||||
|
||||
Reference in New Issue
Block a user