mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Merge pull request #372 from edmorley/flake8
Add flake8 to the Travis run
This commit is contained in:
@@ -16,4 +16,6 @@ install:
|
||||
- "pipenv install --dev"
|
||||
# command to run tests
|
||||
script:
|
||||
# flake8 has dropped support for Python 2.6.
|
||||
- if [[ "$TRAVIS_PYTHON_VERSION" != "2.6" ]]; then pipenv run flake8; fi
|
||||
- pipenv run pytest tests
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
[dev-packages]
|
||||
flake8 = ">=3.3.0,<4"
|
||||
pytest = "*"
|
||||
mock = "*"
|
||||
"delegator.py" = ">=0.0.10"
|
||||
|
||||
Generated
+36
-18
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "8cba5434b2ba425d05649334b063af088196a5208a5a7c9ae52be9e1467824b8"
|
||||
"sha256": "d099a1995f5e9122193bde9a54f4ca624afb2abdf0cf75e76b1930464966ea86"
|
||||
},
|
||||
"requires": {
|
||||
"python_version": "2.7"
|
||||
@@ -17,7 +17,7 @@
|
||||
"appdirs": {
|
||||
"version": "==1.4.3"
|
||||
},
|
||||
"backports.shutil_get_terminal_size": {
|
||||
"backports.shutil-get-terminal-size": {
|
||||
"version": "==1.0.0"
|
||||
},
|
||||
"packaging": {
|
||||
@@ -52,39 +52,45 @@
|
||||
}
|
||||
},
|
||||
"develop": {
|
||||
"Babel": {
|
||||
"version": "==2.4.0"
|
||||
},
|
||||
"Jinja2": {
|
||||
"version": "==2.9.6"
|
||||
},
|
||||
"MarkupSafe": {
|
||||
"version": "==1.0"
|
||||
},
|
||||
"Pygments": {
|
||||
"version": "==2.2.0"
|
||||
},
|
||||
"Sphinx": {
|
||||
"version": "==1.5.5"
|
||||
},
|
||||
"alabaster": {
|
||||
"version": "==0.7.10"
|
||||
},
|
||||
"appdirs": {
|
||||
"version": "==1.4.3"
|
||||
},
|
||||
"babel": {
|
||||
"version": "==2.4.0"
|
||||
},
|
||||
"configparser": {
|
||||
"version": "==3.5.0"
|
||||
},
|
||||
"delegator.py": {
|
||||
"version": "==0.0.10"
|
||||
},
|
||||
"docutils": {
|
||||
"version": "==0.13.1"
|
||||
},
|
||||
"enum34": {
|
||||
"version": "==1.1.6"
|
||||
},
|
||||
"flake8": {
|
||||
"version": "==3.3.0"
|
||||
},
|
||||
"funcsigs": {
|
||||
"version": "==1.0.2"
|
||||
},
|
||||
"imagesize": {
|
||||
"version": "==0.7.1"
|
||||
},
|
||||
"jinja2": {
|
||||
"version": "==2.9.6"
|
||||
},
|
||||
"markupsafe": {
|
||||
"version": "==1.0"
|
||||
},
|
||||
"mccabe": {
|
||||
"version": "==0.6.1"
|
||||
},
|
||||
"mock": {
|
||||
"version": "==2.0.0"
|
||||
},
|
||||
@@ -103,11 +109,20 @@
|
||||
"py": {
|
||||
"version": "==1.4.33"
|
||||
},
|
||||
"pycodestyle": {
|
||||
"version": "==2.3.1"
|
||||
},
|
||||
"pyflakes": {
|
||||
"version": "==1.5.0"
|
||||
},
|
||||
"pygments": {
|
||||
"version": "==2.2.0"
|
||||
},
|
||||
"pyparsing": {
|
||||
"version": "==2.2.0"
|
||||
},
|
||||
"pytest": {
|
||||
"version": "==3.0.7"
|
||||
"version": "==3.1.0"
|
||||
},
|
||||
"pytz": {
|
||||
"version": "==2017.2"
|
||||
@@ -124,6 +139,9 @@
|
||||
"snowballstemmer": {
|
||||
"version": "==1.2.1"
|
||||
},
|
||||
"sphinx": {
|
||||
"version": "==1.5.5"
|
||||
},
|
||||
"toml": {
|
||||
"version": "==0.9.2"
|
||||
}
|
||||
|
||||
+5
-4
@@ -22,7 +22,7 @@ from requests.packages.urllib3.exceptions import InsecureRequestWarning
|
||||
|
||||
from .project import Project
|
||||
from .utils import (convert_deps_from_pip, convert_deps_to_pip, is_required_version,
|
||||
proper_case, pep423_name, split_vcs, recase_file)
|
||||
proper_case, pep423_name, split_vcs)
|
||||
from .__version__ import __version__
|
||||
from . import pep508checker, progress
|
||||
from .environments import PIPENV_COLORBLIND, PIPENV_NOSPIN, PIPENV_SHELL_COMPAT, PIPENV_VENV_IN_PROJECT
|
||||
@@ -51,7 +51,7 @@ if PIPENV_COLORBLIND:
|
||||
|
||||
# Disable spinner, for cleaner build logs (the unworthy).
|
||||
if PIPENV_NOSPIN:
|
||||
@contextlib.contextmanager
|
||||
@contextlib.contextmanager # noqa: F811
|
||||
def spinner():
|
||||
yield
|
||||
|
||||
@@ -261,7 +261,7 @@ def do_install_dependencies(dev=False, only=False, bare=False, requirements=Fals
|
||||
|
||||
# pip install:
|
||||
for dep in progress.bar(hashed_deps):
|
||||
|
||||
|
||||
c = pip_install(dep, ignore_hashes=ignore_hashes, allow_global=allow_global)
|
||||
|
||||
if c.return_code != 0:
|
||||
@@ -463,7 +463,7 @@ def do_lock(no_hashes=True):
|
||||
names_map = do_download_dependencies(dev=True, only=True, bare=True)
|
||||
|
||||
# Load the Pipfile and generate a lockfile.
|
||||
p = project._pipfile
|
||||
project._pipfile
|
||||
lockfile = project._lockfile
|
||||
|
||||
# Pip freeze development dependencies.
|
||||
@@ -543,6 +543,7 @@ def do_activate_virtualenv(bare=False):
|
||||
else:
|
||||
click.echo(activate_virtualenv())
|
||||
|
||||
|
||||
def do_purge(bare=False, downloads=False, allow_global=False):
|
||||
"""Executes the purge functionality."""
|
||||
|
||||
|
||||
@@ -28,4 +28,4 @@ if PIPENV_VENV_IN_PROJECT:
|
||||
|
||||
# Disable spinner on windows.
|
||||
if os.name == 'nt':
|
||||
PIPENV_NOSPIN = True
|
||||
PIPENV_NOSPIN = True
|
||||
|
||||
+1
-1
@@ -168,4 +168,4 @@ def mill(it, label='', hide=None, expected_size=None, every=1):
|
||||
|
||||
if not hide:
|
||||
STREAM.write('\n')
|
||||
STREAM.flush()
|
||||
STREAM.flush()
|
||||
|
||||
+3
-7
@@ -7,16 +7,12 @@ import requests
|
||||
import requirements
|
||||
import six
|
||||
|
||||
try:
|
||||
from HTMLParser import HTMLParser
|
||||
except ImportError:
|
||||
from html.parser import HTMLParser
|
||||
|
||||
# List of version control systems we support.
|
||||
VCS_LIST = ('git', 'svn', 'hg', 'bzr')
|
||||
|
||||
requests = requests.session()
|
||||
|
||||
|
||||
def format_toml(data):
|
||||
"""Pretty-formats a given toml string."""
|
||||
data = data.split('\n')
|
||||
@@ -203,7 +199,7 @@ def split_vcs(split_file):
|
||||
elif 'default' in split_file or 'develop' in split_file:
|
||||
sections = ('default', 'develop')
|
||||
|
||||
# For each vcs entry in a given section, move it to section-vcs.
|
||||
# For each vcs entry in a given section, move it to section-vcs.
|
||||
for section in sections:
|
||||
entries = split_file.get(section, {})
|
||||
vcs_dict = dict((k, entries.pop(k)) for k in list(entries.keys()) if is_vcs(entries[k]))
|
||||
@@ -243,7 +239,7 @@ def walk_up(bottom):
|
||||
# get files in current dir
|
||||
try:
|
||||
names = os.listdir(bottom)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
return
|
||||
|
||||
dirs, nondirs = [], []
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
[flake8]
|
||||
exclude = .git,__pycache__,docs/,pipenv/vendor/,get-pipenv.py
|
||||
ignore =
|
||||
# The default ignore list:
|
||||
E121,E123,E126,E226,E24,E704,
|
||||
# Our additions:
|
||||
# E127: continuation line over-indented for visual indent
|
||||
# E128: continuation line under-indented for visual indent
|
||||
# E129: visually indented line with same indent as next logical line
|
||||
# E222: multiple spaces after operator
|
||||
# E231: missing whitespace after ','
|
||||
# E402: module level import not at top of file
|
||||
# E501: line too long
|
||||
E127,E128,E129,E222,E231,E402,E501
|
||||
@@ -7,7 +7,7 @@ import delegator
|
||||
import toml
|
||||
|
||||
from pipenv.cli import (activate_virtualenv, ensure_proper_casing,
|
||||
parse_download_fname, parse_install_output, pip_install, pip_download, which_pip)
|
||||
parse_download_fname, parse_install_output, pip_install, pip_download)
|
||||
from pipenv.project import Project
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import delegator
|
||||
|
||||
import pipenv.project
|
||||
|
||||
|
||||
class TestProject():
|
||||
|
||||
def test_project(self):
|
||||
|
||||
+1
-4
@@ -4,6 +4,7 @@ import pytest
|
||||
|
||||
import pipenv.utils
|
||||
|
||||
|
||||
class TestUtils:
|
||||
|
||||
"""Test utility functions in pipenv"""
|
||||
@@ -71,7 +72,6 @@ class TestUtils:
|
||||
deps = pipenv.utils.convert_deps_to_pip(deps, r=False)
|
||||
assert deps[0] == 'django==1.10'
|
||||
|
||||
|
||||
def test_convert_from_pip(self):
|
||||
|
||||
# requests
|
||||
@@ -109,7 +109,6 @@ class TestUtils:
|
||||
dep = pipenv.utils.convert_deps_from_pip(dep)
|
||||
assert 'pipenv requires an #egg fragment for vcs' in str(e)
|
||||
|
||||
|
||||
@pytest.mark.parametrize('version, specified_ver, expected', [
|
||||
('*', '*', True),
|
||||
('2.1.6', '==2.1.4', False),
|
||||
@@ -120,7 +119,6 @@ class TestUtils:
|
||||
def test_is_required_version(self, version, specified_ver, expected):
|
||||
assert pipenv.utils.is_required_version(version, specified_ver) is expected
|
||||
|
||||
|
||||
@pytest.mark.parametrize('entry, expected', [
|
||||
({'git': 'package.git', 'ref': 'v0.0.1'}, True),
|
||||
({'hg': 'https://package.com/package', 'ref': 'v1.2.3'}, True),
|
||||
@@ -131,7 +129,6 @@ class TestUtils:
|
||||
def test_is_vcs(self, entry, expected):
|
||||
assert pipenv.utils.is_vcs(entry) is expected
|
||||
|
||||
|
||||
def test_split_vcs(self):
|
||||
pipfile_dict = {
|
||||
'packages': {
|
||||
|
||||
Reference in New Issue
Block a user