Skip to content

Commit

Permalink
Cut over to devpi for tests and improve logging
Browse files Browse the repository at this point in the history
- Verbose logs will now write gracefully to the terminal even while the
  spinner is running (i.e. during locking)
- This PR also cuts over to Devpi for a backing cache rather than a
  hacked httpbin instance
- Inclues a refactor of `pip_install` to deduplicate logic
- Attempts to switch back to relying on native editable installs in pip
  as the current implementation is broken on master (i.e. nothing is
  installed in the virtualenv)
- Fixes #3809

Signed-off-by: Dan Ryan <dan@danryan.co>
  • Loading branch information
techalchemy committed Jun 25, 2019
1 parent 8b244be commit 83868c8
Show file tree
Hide file tree
Showing 27 changed files with 1,025 additions and 542 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
url = https://github.com/pinax/pinax.git
[submodule "tests/test_artifacts/git/requests"]
path = tests/test_artifacts/git/requests
url = https://github.com/requests/requests.git
url = https://github.com/kennethreitz/requests.git
[submodule "tests/test_artifacts/git/six"]
path = tests/test_artifacts/git/six
url = https://github.com/benjaminp/six.git
Expand All @@ -24,7 +24,7 @@
url = https://github.com/pallets/flask.git
[submodule "tests/test_artifacts/git/requests-2.18.4"]
path = tests/test_artifacts/git/requests-2.18.4
url = https://github.com/requests/requests
url = https://github.com/kennethreitz/requests
[submodule "tests/pypi"]
path = tests/pypi
url = https://github.com/sarugaku/pipenv-test-artifacts.git
46 changes: 46 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,50 @@
get_venv_dir:=$(shell mktemp -d 2>/dev/null || mktemp -d -t 'tmpvenv')
venv_dir := $(get_venv_dir)/pipenv_venv
venv_file := $(CURDIR)/.test_venv
get_venv_path =$(file < $(venv_file))

format:
black pipenv/*.py
test:
docker-compose up

.PHONY: ramdisk
ramdisk:
sudo mkdir -p /mnt/ramdisk
sudo mount -t tmpfs -o size=2g tmpfs /mnt/ramdisk
sudo chown -R ${USER}:${USER} /mnt/ramdisk

.PHONY: ramdisk-virtualenv
ramdisk-virtualenv: ramdisk
[ ! -e "/mnt/ramdisk/.venv/bin/activate" ] && \
python -m virtualenv /mnt/ramdisk/.venv
@echo "/mnt/ramdisk/.venv" >> $(venv_file)

.PHONY: virtualenv
virtualenv:
[ ! -e $(venv_dir) ] && rm -rf $(venv_file) && python -m virtualenv $(venv_dir)
@echo $(venv_dir) >> $(venv_file)

.PHONY: test-install
test-install: virtualenv
. $(get_venv_path)/bin/activate && \
python -m pip install --upgrade pip virtualenv -e .[tests,dev] && \
pipenv install --dev

.PHONY: submodules
submodules:
git submodule sync
git submodule update --init --recursive

.PHONY: tests
tests: virtualenv submodules test-install
. $(get_venv_path)/bin/activate && \
pipenv run pytest -ra -vvv --full-trace --tb=long

.PHONY: test-specific
test-specific: submodules virtualenv test-install
. $(get_venv_path)/bin/activate && pipenv run pytest -ra -k '$(tests)'

.PHONY: retest
retest: virtualenv submodules test-install
. $(get_venv_path)/bin/activate && pipenv run pytest -ra -k 'test_check_unused or test_install_editable_git_tag or test_get_vcs_refs or test_skip_requirements_when_pipfile or test_editable_vcs_install or test_basic_vcs_install or test_git_vcs_install or test_ssh_vcs_install or test_vcs_can_use_markers' -vvv --full-trace --tb=long
373 changes: 372 additions & 1 deletion Pipfile.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions news/3809.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed several bugs which could prevent editable VCS dependencies from being installed into target environments, even when reporting successful installation.
1 change: 1 addition & 0 deletions news/3810.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improved verbose logging output during ``pipenv lock`` will now stream output to the console while maintaining a spinner.
2 changes: 2 additions & 0 deletions pipenv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@
pass

from pipenv.vendor.vistir.misc import get_text_stream

stdout = get_text_stream("stdout")
stderr = get_text_stream("stderr")

if os.name == "nt":
from pipenv.vendor.vistir.misc import _can_use_color, _wrap_for_color

if _can_use_color(stdout):
stdout = _wrap_for_color(stdout)
if _can_use_color(stderr):
Expand Down
Loading

0 comments on commit 83868c8

Please sign in to comment.