Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

Commit

Permalink
Merge branch 'development' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskuehl committed Sep 30, 2016
2 parents b72d374 + 9516e23 commit 343be0b
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 24 deletions.
4 changes: 0 additions & 4 deletions .activate.sh

This file was deleted.

1 change: 1 addition & 0 deletions .activate.sh
1 change: 0 additions & 1 deletion .deactivate.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
deactivate
unset TOP
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- id: double-quote-string-fixer
- id: end-of-file-fixer
- id: flake8
exclude: ^docs/
- repo: git://github.com/asottile/reorder_python_imports
sha: 8b583ac1beb0dd0f14c4bceb0a53bb1023cb3dd7
hooks:
Expand Down
3 changes: 2 additions & 1 deletion CI/circle/main
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ lsb_release -a
test $CIRCLE_NODE_TOTAL -eq 4

timestamp
sudo apt-get install python2.7-dev python3.4-dev
sudo apt-get update
sudo apt-get install -y python2.7-dev python3.4-dev

### per-node actions
timestamp
Expand Down
23 changes: 22 additions & 1 deletion pip_faster.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,25 @@ def is_local_directory(url):
return isdir(url[5:])


def is_vcs_url(url):
"""Test if a URL is a VCS repo.
>>> is_vcs_url('git+git://git.myproject.org/MyProject#egg=MyProject')
True
>>> is_vcs_url('svn+http://svn.myproject.org/svn/MyProject/trunk@2019#egg=MyProject')
True
>>> is_vcs_url('file:///tmp/')
False
"""
if url is None:
return False
else:
return url.startswith(tuple(
scheme + '+'
for scheme in pipmodule.vcs.vcs
))


def optimistic_wheel_search(req, find_links):
assert req_is_pinned(req), req

Expand Down Expand Up @@ -145,7 +164,9 @@ def wheelable(req):
# we don't want to permanently cache something we'll edit
not req.editable and
# people expect `pip install .` to work without bumping the version
not is_local_directory(req.url)
not is_local_directory(req.url) and
# don't cache vcs packages, since the version is often bogus (#156)
not is_vcs_url(req.url)
)


Expand Down
4 changes: 2 additions & 2 deletions pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class-rgx=%(const-rgx)s
[FORMAT]
max-line-length=131

# TODO: we'd like to hit 250 here
max-module-lines=532
# TODO: we'd like to hit this
# max-module-lines=250

[TYPECHECK]
ignored-classes=pytest,LocalPath,RootLogger
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/get_installed_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_pip_get_installed(tmpdir):
run('myvenv/bin/pip', 'uninstall', '--yes', 'cov-core', 'coverage', 'py', 'pytest', 'pytest-cov')
assert get_installed() == []

run('myvenv/bin/pip', 'install', 'flake8')
run('myvenv/bin/pip', 'install', 'flake8==2.5.0')
assert get_installed() == ['flake8', 'mccabe', 'pep8', 'pyflakes']

run('myvenv/bin/pip', 'uninstall', '--yes', 'flake8')
Expand Down
34 changes: 31 additions & 3 deletions tests/functional/pip_faster.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def it_installs_stuff(tmpdir):
install_coverage(venv)

assert pip_freeze(str(venv)) == '''\
coverage==4.0.3
coverage==4.2
coverage-enable-subprocess==1.0
'''

Expand Down Expand Up @@ -89,7 +89,7 @@ def it_installs_stuff_with_dash_e_without_wheeling(tmpdir):
assert set(frozen_requirements) == set([
'-e git://github.com/Yelp/dumb-init.git@87545be699a13d0fd31f67199b7782ebd446437e#egg=dumb_init-dev', # noqa
'coverage-enable-subprocess==1.0',
'coverage==4.0.3',
'coverage==4.2',
'venv-update==' + __version__,
'wheel==0.29.0',
'',
Expand Down Expand Up @@ -117,7 +117,7 @@ def it_doesnt_wheel_local_dirs(tmpdir):

frozen_requirements = pip_freeze(str(venv)).split('\n')
assert set(frozen_requirements) == set([
'coverage==4.0.3',
'coverage==4.2',
'coverage-enable-subprocess==1.0',
'dependant-package==1',
'implicit-dependency==1',
Expand All @@ -136,6 +136,34 @@ def it_doesnt_wheel_local_dirs(tmpdir):
])


@pytest.mark.usefixtures('pypi_server')
def it_doesnt_wheel_git_repos(tmpdir):
venv = tmpdir.join('venv')
install_coverage(venv)

pip = venv.join('bin/pip').strpath
run(pip, 'install', 'venv-update==' + __version__)

run(
venv.join('bin/pip-faster').strpath,
'install',
'git+git://github.com/Yelp/dumb-init.git@87545be699a13d0fd31f67199b7782ebd446437e#egg=dumb-init', # noqa
)

frozen_requirements = pip_freeze(str(venv)).split('\n')
assert set(frozen_requirements) == set([
'coverage-enable-subprocess==1.0',
'coverage==4.2',
'dumb-init==0.5.0',
'venv-update==' + __version__,
'wheel==0.29.0',
'',
])

wheelhouse = tmpdir.join('home', '.cache', 'pip-faster', 'wheelhouse')
assert set(Wheel(f.basename).name for f in wheelhouse.listdir()) == set()


@pytest.mark.usefixtures('pypi_server')
def it_can_handle_requirements_already_met(tmpdir):
venv = tmpdir.join('venv')
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/simple_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def flake8_older():
''' % TOP)
venv_update()
assert pip_freeze() == '\n'.join((
'coverage==4.0.3',
'coverage==4.2',
'coverage-enable-subprocess==1.0',
'flake8==2.0',
'mccabe==0.3',
Expand All @@ -306,7 +306,7 @@ def flake8_newer():
''' % TOP)
venv_update()
assert pip_freeze() == '\n'.join((
'coverage==4.0.3',
'coverage==4.2',
'coverage-enable-subprocess==1.0',
'flake8==2.2.5',
'mccabe==0.3',
Expand Down
10 changes: 5 additions & 5 deletions tests/unit/fix_coverage_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ def test_fix_coverage(tmpdir):
str(unrelated_file): {(5, 6): None},
})

assert coverage_data.lines(base_file) == [1]
assert coverage_data.lines(sub_file) == [3]
assert coverage_data.lines(unrelated_file) == [5]
assert coverage_data.lines(base_file) == [1, 2]
assert coverage_data.lines(sub_file) == [3, 4]
assert coverage_data.lines(unrelated_file) == [5, 6]

merge_coverage(coverage_data, '/site-packages/', str(tmpdir))

# The base file should contain all the lines and arcs
assert coverage_data.lines(base_file) == [1, 3]
assert coverage_data.lines(base_file) == [1, 2, 3, 4]
assert coverage_data.arcs(base_file) == [(1, 2), (3, 4)]
assert coverage_data.lines(unrelated_file) == [5]
assert coverage_data.lines(unrelated_file) == [5, 6]
assert coverage_data.arcs(unrelated_file) == [(5, 6)]

# And the sub file should no longer exist
Expand Down
7 changes: 5 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ skipsdist=True
passenv =
PYTEST_OPTIONS
PYTHON
changedir =
changedir =
{envtmpdir}
setenv =
setenv =
TOP={toxinidir}
SITEPACKAGES={envsitepackagesdir}
venv_update =
Expand All @@ -33,3 +33,6 @@ commands =
deps = -rrequirements.d/docs.txt
changedir = docs
commands = sphinx-build -b html -d build/doctrees source build/html

[flake8]
max-line-length = 131
4 changes: 2 additions & 2 deletions venv_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
from os.path import exists
from os.path import join

__version__ = '1.1.0'
__version__ = '1.1.1'
DEFAULT_VIRTUALENV_PATH = 'venv'
DEFAULT_OPTION_VALUES = {
'venv=': (DEFAULT_VIRTUALENV_PATH,),
Expand Down Expand Up @@ -163,7 +163,7 @@ def exec_(argv): # never returns
"""Wrapper to os.execv which shows the command and runs any atexit handlers (for coverage's sake).
Like os.execv, this function never returns.
"""
## info('EXEC' + colorize(argv)) # TODO: debug logging by environment variable
# info('EXEC' + colorize(argv)) # TODO: debug logging by environment variable

# in python3, sys.exitfunc has gone away, and atexit._run_exitfuncs seems to be the only pubic-ish interface
# https://hg.python.org/cpython/file/3.4/Modules/atexitmodule.c#l289
Expand Down

0 comments on commit 343be0b

Please sign in to comment.