diff --git a/.gitmodules b/.gitmodules index fb727deeb2..e2f779afa6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 @@ -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 diff --git a/Makefile b/Makefile index 2722bdb47e..059945bbb1 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/Pipfile.lock b/Pipfile.lock index 1675ad80ab..94693e77f2 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -37,6 +37,29 @@ ], "version": "==1.4.3" }, + "argon2-cffi": { + "hashes": [ + "sha256:1029fef2f7808a89e3baa306f5ace36e768a2d847ee7b056399adcd7707f6256", + "sha256:206857d870c6ca3c92514ca70a3c371be47383f7ae6a448f5a16aa17baa550ba", + "sha256:3558a7e22b886efad0c99b23b9be24880213b4e2d1630095459978cfcae570e2", + "sha256:457fd6de741859aa91c750ffad97f12675c4356047e43392c5fb21f5d9f48b24", + "sha256:4a1daa9f6960cdbdb865efcabac4158693459f52e7582c9f8a7c92dc61cdc8e1", + "sha256:4bfb603184ea678563c0f1f1872367e81a3d2b70646a627d38ccede68d7b9194", + "sha256:5d7493ed10e384b84b6dac862fe96c443297a25b991a8364d94a67b6cd1e9569", + "sha256:5fb080047517add8d27baeb38a314814b5ab9c72630606788909b3f60a8f054a", + "sha256:7453b16496b5629005a43c5f5707ef8a31fcfa5bb0ed34b5ba7b86a3cc9d02f2", + "sha256:81548a27b919861040cb928a350733f4f9455dd67c7d1ba92eb5960a1d7f8b26", + "sha256:84fd768d523f87097d572cdfb98e868cdbdc8e80e3d444787fd32e7f6ae25b02", + "sha256:8b4cf6c0298f33b92fcd50f19899175b7421690fc8bc6ac68368320c158cbf51", + "sha256:af6a4799411eee3f7133fead973727f5fefacd18ea23f51039e70cae51ceb109", + "sha256:df7d60a4cf58dc08319fedc0506b42ec0fa5221c6e1f9e2e89fcddff92507390", + "sha256:f9072e9f70185a57e36228d34aad4bb644e6a8b4fd6a45f856c666f38f6de96c", + "sha256:fbae1d08b52f9a791500c650ab51ba00e374eaeccb5dbaa41b99dab4fd4115e8", + "sha256:fe91e3bd95aeae70366693dcc970db03a71619d19df6fbaabf662c3b3c54cdf8", + "sha256:fec86ee6f913154846171f66ee30c893c0cde3d434911f8b31c1f84a9aea410e" + ], + "version": "==19.1.0" + }, "arpeggio": { "hashes": [ "sha256:a5258b84f76661d558492fa87e42db634df143685a0e51802d59cae7daad8732", @@ -112,6 +135,39 @@ ], "version": "==2019.6.16" }, + "cffi": { + "hashes": [ + "sha256:041c81822e9f84b1d9c401182e174996f0bae9991f33725d059b771744290774", + "sha256:046ef9a22f5d3eed06334d01b1e836977eeef500d9b78e9ef693f9380ad0b83d", + "sha256:066bc4c7895c91812eff46f4b1c285220947d4aa46fa0a2651ff85f2afae9c90", + "sha256:066c7ff148ae33040c01058662d6752fd73fbc8e64787229ea8498c7d7f4041b", + "sha256:2444d0c61f03dcd26dbf7600cf64354376ee579acad77aef459e34efcb438c63", + "sha256:300832850b8f7967e278870c5d51e3819b9aad8f0a2c8dbe39ab11f119237f45", + "sha256:34c77afe85b6b9e967bd8154e3855e847b70ca42043db6ad17f26899a3df1b25", + "sha256:46de5fa00f7ac09f020729148ff632819649b3e05a007d286242c4882f7b1dc3", + "sha256:4aa8ee7ba27c472d429b980c51e714a24f47ca296d53f4d7868075b175866f4b", + "sha256:4d0004eb4351e35ed950c14c11e734182591465a33e960a4ab5e8d4f04d72647", + "sha256:4e3d3f31a1e202b0f5a35ba3bc4eb41e2fc2b11c1eff38b362de710bcffb5016", + "sha256:50bec6d35e6b1aaeb17f7c4e2b9374ebf95a8975d57863546fa83e8d31bdb8c4", + "sha256:55cad9a6df1e2a1d62063f79d0881a414a906a6962bc160ac968cc03ed3efcfb", + "sha256:5662ad4e4e84f1eaa8efce5da695c5d2e229c563f9d5ce5b0113f71321bcf753", + "sha256:59b4dc008f98fc6ee2bb4fd7fc786a8d70000d058c2bbe2698275bc53a8d3fa7", + "sha256:73e1ffefe05e4ccd7bcea61af76f36077b914f92b76f95ccf00b0c1b9186f3f9", + "sha256:a1f0fd46eba2d71ce1589f7e50a9e2ffaeb739fb2c11e8192aa2b45d5f6cc41f", + "sha256:a2e85dc204556657661051ff4bab75a84e968669765c8a2cd425918699c3d0e8", + "sha256:a5457d47dfff24882a21492e5815f891c0ca35fefae8aa742c6c263dac16ef1f", + "sha256:a8dccd61d52a8dae4a825cdbb7735da530179fea472903eb871a5513b5abbfdc", + "sha256:ae61af521ed676cf16ae94f30fe202781a38d7178b6b4ab622e4eec8cefaff42", + "sha256:b012a5edb48288f77a63dba0840c92d0504aa215612da4541b7b42d849bc83a3", + "sha256:d2c5cfa536227f57f97c92ac30c8109688ace8fa4ac086d19d0af47d134e2909", + "sha256:d42b5796e20aacc9d15e66befb7a345454eef794fdb0737d1af593447c6c8f45", + "sha256:dee54f5d30d775f525894d67b1495625dd9322945e7fee00731952e0368ff42d", + "sha256:e070535507bd6aa07124258171be2ee8dfc19119c28ca94c9dfb7efd23564512", + "sha256:e1ff2748c84d97b065cc95429814cdba39bcbd77c9c85c89344b317dc0d9cbff", + "sha256:ed851c75d1e0e043cbf5ca9a8e1b13c4c90f3fbd863dacb01c0808e2b5204201" + ], + "version": "==1.12.3" + }, "chardet": { "hashes": [ "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", @@ -119,6 +175,14 @@ ], "version": "==3.0.4" }, + "check-manifest": { + "hashes": [ + "sha256:8754cc8efd7c062a3705b442d1c23ff702d4477b41a269c2e354b25e1f5535a4", + "sha256:a4c555f658a7c135b8a22bd26c2e55cfaf5876e4d5962d8c25652f2addd556bc" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==0.39" + }, "click": { "hashes": [ "sha256:2335065e6395b9e67ca716de5f7526736bfa6ceead690adf616d925bdc622b13", @@ -127,6 +191,13 @@ "index": "pypi", "version": "==7.0" }, + "colorama": { + "hashes": [ + "sha256:05eed71e2e327246ad6b38c540c4a3117230b19679b875190486ddd2d721422d", + "sha256:f8ac84de7840f5b9c4e3347b3c1eaa50f7e49c2b07596221daec5edaabbd7c48" + ], + "version": "==0.4.1" + }, "configparser": { "hashes": [ "sha256:8be81d89d6e7b4c0d4e44bcc525845f6da25821de80cb5e06e7e0238a2899e32", @@ -143,6 +214,34 @@ "markers": "python_version < '3'", "version": "==0.5.5" }, + "decorator": { + "hashes": [ + "sha256:86156361c50488b84a3f148056ea716ca587df2f0de1d34750d35c21312725de", + "sha256:f069f3a01830ca754ba5258fde2278454a0b5b79e0d7f5c13b3b97e57d4acff6" + ], + "version": "==4.4.0" + }, + "devpi-client": { + "hashes": [ + "sha256:05398402d4335a8173d9118df409d16e085a6dacf54300851212d2f6370e1497", + "sha256:e9e19e87c61a75bc93137553db69554c69efb82cfc7ee83e0305cf6abfc91aa0" + ], + "version": "==4.4.0" + }, + "devpi-common": { + "hashes": [ + "sha256:2c7a6471c0f5b07ac9257adec3b3c3a89193ee672fdeb0a6f29487dc9d675e0c", + "sha256:c743abd38447258e27cdb733fa905c275e5dd3eeae25bab9ff59182a1083ed91" + ], + "version": "==3.3.2" + }, + "devpi-server": { + "hashes": [ + "sha256:96ab6390ea8aa2e80b4acdcf8e37f105af6ce7d0cb4efa18ba82de8e8b6c91ad", + "sha256:e92de95c869927ba628d25b024c460b63740d52ebba11dae79146d8cc3b6a033" + ], + "version": "==4.9.0" + }, "docutils": { "hashes": [ "sha256:02aec4bd92ab067f6ff27a38a38a41173bf01bed8f89157768c1573f53e474a6", @@ -177,6 +276,13 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==1.6.0" }, + "filelock": { + "hashes": [ + "sha256:18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59", + "sha256:929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836" + ], + "version": "==3.0.12" + }, "flake8": { "hashes": [ "sha256:859996073f341f2670741b51ec1e67a01da142831aa1fdc6242dbf88dffbe661", @@ -205,7 +311,7 @@ "sha256:330cc27ccbf7f1e992e69fef78261dc7c6569012cf397db8d3de0234e6c937ca", "sha256:a7bb0f2cf3a3fd1ab2732cb49eba4252c2af4240442415b4abce3b87022a8f50" ], - "markers": "python_version < '3.3'", + "markers": "python_version < '3.0'", "version": "==1.0.2" }, "functools32": { @@ -216,6 +322,13 @@ "markers": "python_version < '3.2'", "version": "==3.2.3.post2" }, + "future": { + "hashes": [ + "sha256:67045236dcfd6816dc439556d009594abf643e5eb48992e36beac09c2ca659b8" + ], + "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==0.17.1" + }, "futures": { "hashes": [ "sha256:9ec02aa7d674acb8618afb127e27fde7fc68994c0437ad759fa094a574adb265", @@ -224,6 +337,14 @@ "markers": "python_version < '3.2'", "version": "==3.2.0" }, + "hupper": { + "hashes": [ + "sha256:5869ec2a46ba8ad481b0a27ca68f3e01dc7d3424925b7c872d9fcdff44b43442", + "sha256:8532d116fef1f89add74dbd8d5e6541cb3278b04f4fe9780a1356cb6adba1141" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==1.8.1" + }, "idna": { "hashes": [ "sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407", @@ -350,6 +471,13 @@ ], "version": "==5.0.0" }, + "orderedmultidict": { + "hashes": [ + "sha256:24e3b730cf84e4a6a68be5cc760864905cf66abc89851e724bd5b4e849eaa96b", + "sha256:b89895ba6438038d0bdf88020ceff876cf3eae0d5c66a69b526fab31125db2c5" + ], + "version": "==1.0" + }, "packaging": { "hashes": [ "sha256:0c98a5d0be38ed775798ece1b9727178c4469d9c3b4ada66e8e6b7849f8732af", @@ -378,6 +506,31 @@ "ref": "a2ba0b30c86339cae5ef3a03046fc9c583452c40", "version": "==0.3.1.dev0" }, + "passlib": { + "extras": [ + "argon2" + ], + "hashes": [ + "sha256:3d948f64138c25633613f303bcc471126eae67c04d5e3f6b7b8ce6242f8653e0", + "sha256:43526aea08fa32c6b6dbbbe9963c4c767285b78147b7437597f992812f69d280" + ], + "version": "==1.7.1" + }, + "pastedeploy": { + "hashes": [ + "sha256:d423fb9d51fdcf853aa4ff43ac7ec469b643ea19590f67488122d6d0d772350a", + "sha256:fe53697ec2754703096b75d0ba29112b0590b4ce46726fe4f9408fd006e4eefc" + ], + "version": "==2.0.1" + }, + "path.py": { + "hashes": [ + "sha256:9f2169633403aa0423f6ec000e8701dd1819526c62465f5043952f92527fea0f", + "sha256:e107a3a8834a97be2a047f4b641822afc76a2b78352610102782732e6b389aa3" + ], + "markers": "python_version >= '3.5'", + "version": "==12.0.1" + }, "pathlib2": { "hashes": [ "sha256:25199318e8cc3c25dcb45cbe084cc061051336d5a9ea2a12448d3d8cb748f742", @@ -408,6 +561,22 @@ ], "version": "==1.5.0.1" }, + "plaster": { + "hashes": [ + "sha256:215c921a438b5349931fd7df9a5a11a3572947f20f4bc6dd622ac08f1c3ba249", + "sha256:8351c7c7efdf33084c1de88dd0f422cbe7342534537b553c49b857b12d98c8c3" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==1.0" + }, + "plaster-pastedeploy": { + "hashes": [ + "sha256:391d93a4e1ff81fc3bae27508ebb765b61f1724ae6169f83577f06b6357be7fd", + "sha256:7c8aa37c917b615c70bf942b24dc1e0455c49f62f1a2214b1a0dd98871644bbb" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==0.7" + }, "pluggy": { "hashes": [ "sha256:0825a152ac059776623854c1543d65a4ad408eb3d33ee114dff91e57ec6ae6fc", @@ -416,6 +585,21 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==0.12.0" }, + "psutil": { + "hashes": [ + "sha256:028a1ec3c6197eadd11e7b46e8cc2f0720dc18ac6d7aabdb8e8c0d6c9704f000", + "sha256:503e4b20fa9d3342bcf58191bbc20a4a5ef79ca7df8972e6197cc14c5513e73d", + "sha256:863a85c1c0a5103a12c05a35e59d336e1d665747e531256e061213e2e90f63f3", + "sha256:954f782608bfef9ae9f78e660e065bd8ffcfaea780f9f2c8a133bb7cb9e826d7", + "sha256:b6e08f965a305cd84c2d07409bc16fbef4417d67b70c53b299116c5b895e3f45", + "sha256:bc96d437dfbb8865fc8828cf363450001cb04056bbdcdd6fc152c436c8a74c61", + "sha256:cf49178021075d47c61c03c0229ac0c60d5e2830f8cab19e2d88e579b18cdb76", + "sha256:d5350cb66690915d60f8b233180f1e49938756fb2d501c93c44f8fb5b970cc63", + "sha256:eba238cf1989dfff7d483c029acb0ac4fcbfc15de295d682901f0e2497e6781a" + ], + "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==5.6.3" + }, "py": { "hashes": [ "sha256:64f65755aee5b381cea27766a3a147c3f15b9b6b9ac88676de66ba2ae36793fa", @@ -432,6 +616,12 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==2.5.0" }, + "pycparser": { + "hashes": [ + "sha256:a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3" + ], + "version": "==2.19" + }, "pyflakes": { "hashes": [ "sha256:17dbeb2e3f4d772725c777fabc446d5634d1038f234e77343108ce445ea69ce0", @@ -456,6 +646,14 @@ "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==2.4.0" }, + "pyramid": { + "hashes": [ + "sha256:51bf64647345237c00d2fe558935e0e4938c156e29f17e203457fd8e1d757dc7", + "sha256:d80ccb8cfa550139b50801591d4ca8a5575334adb493c402fce2312f55d07d66" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==1.10.4" + }, "pytest": { "hashes": [ "sha256:4a784f1d4f2ef198fe9b7aef793e9fa1a3b2f84e822d9b3a64a181293a572d45", @@ -464,6 +662,24 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==4.6.3" }, + "pytest-devpi-server": { + "hashes": [ + "sha256:1e1a4f4783f6833e49ae72956e68694b26de85e094d39c9cc6e5900774ecf2b9", + "sha256:a8f37e448d0a8c11c10f51b48a2bae4007431786223c39c3e22343e41f3aa8ee", + "sha256:c54e2ad77f9e2031d0284038b2bd1044debfcd1965be81c3d990df39e80503a3", + "sha256:d5e06acdd89966417d781d93cd08a2f1c21265bc06d5e4c1dd9309cdd0af988f" + ], + "version": "==1.7.0" + }, + "pytest-fixture-config": { + "hashes": [ + "sha256:1413e5e2c6572a3d7709de7ad69dc35004393d777a7883c8431b6f78a2e28fd0", + "sha256:41a17417721f6862ce6b40e3280fddd8e1659b2c306ec46b237d7021fec5218e", + "sha256:9bda6a817a3ac91a118dd42274cb3cc42dc0290a11317a7217d17eaae82800c5", + "sha256:a0e35e239e70fa12614bbe9ca51d3238fbeb89519deb80cd365b487665a666b0" + ], + "version": "==1.7.0" + }, "pytest-forked": { "hashes": [ "sha256:5fe33fbd07d7b1302c95310803a5e5726a4ff7f19d5a542b7ce57c76fed8135f", @@ -475,6 +691,24 @@ "editable": true, "path": "./tests/pytest-pypi" }, + "pytest-server-fixtures": { + "hashes": [ + "sha256:0fa5b1be6a84180e50ff91a58580e81ad3eb45828878a07942fbe384fcd86d1f", + "sha256:3d93f2ca4bb0a949a55cbdd3598fc44bc3199277dd6b31be39df7f7ebb7a3280", + "sha256:42a6020e60fd0c362dae0a594777b85e6b4a6d84ff3972ac3261e7de5f2f27fc", + "sha256:716e8911e0184d0fd41aa04c2980f04f7bf1d603d90d40de4817b8d6f7b5c7d6" + ], + "version": "==1.7.0" + }, + "pytest-shutil": { + "hashes": [ + "sha256:03c67282a0c520a790ca8db6f65e18851fae3786f45e3ae34e8d9fccbf266a72", + "sha256:343a6902a8ed0cbd29cf8954e2726382228a2ad2f5f7eac589b0d0dff878d806", + "sha256:b3568a675cb092c9b15c789ebd3046b79cfaca476868939748729d14557a98ff", + "sha256:d8165261de76e7508505c341d94c02b113dc963f274543abca74dbfabd021261" + ], + "version": "==1.7.0" + }, "pytest-tap": { "hashes": [ "sha256:3b05ec931424bbe44e944726b68f7ef185bb6d25ce9ce21ac52c9af7ffa9b506", @@ -490,6 +724,14 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==1.29.0" }, + "python-dateutil": { + "hashes": [ + "sha256:7e6584c74aeed623791615e26efd690f29817a27c73085b78e4bad02493df2fb", + "sha256:c89805f6f4d64db21ed966fda138f8a5ed7a4fdbc1a8ee329ce1b74e3c74da9e" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==2.8.0" + }, "pytz": { "hashes": [ "sha256:303879e36b721603cc54604edcac9d20401bdbe31e1e4fdee5b9f98d5d31dfda", @@ -504,6 +746,13 @@ ], "version": "==24.0" }, + "repoze.lru": { + "hashes": [ + "sha256:0429a75e19380e4ed50c0694e26ac8819b4ea7851ee1fc7583c8572db80aff77", + "sha256:f77bf0e1096ea445beadd35f3479c5cff2aa1efe604a133e67150bc8630a62ea" + ], + "version": "==0.7" + }, "requests": { "hashes": [ "sha256:11e007a8a2aa0323f5a921e9e6a2d7e4e67d9877e85773fba9ba6419025cbeb4", @@ -519,6 +768,13 @@ ], "version": "==0.9.1" }, + "retry": { + "hashes": [ + "sha256:ccddf89761fa2c726ab29391837d4327f819ea14d244c232a1d24c67a2f98606", + "sha256:f8bfa8b99b69c4506d6f5bd3b0aabf77f98cdb17f3c9fc3f5ca820033336fba4" + ], + "version": "==0.9.2" + }, "rope": { "hashes": [ "sha256:6b728fdc3e98a83446c27a91fc5d56808a004f8beab7a31ab1d7224cecc7d969", @@ -528,6 +784,30 @@ "index": "pypi", "version": "==0.14.0" }, + "ruamel.yaml": { + "hashes": [ + "sha256:17dbf6b7362e7aee8494f7a0f5cffd44902a6331fe89ef0853b855a7930ab845", + "sha256:23731c9efb79f3f5609dedffeb6c5c47a68125fd3d4b157d9fc71b1cd49076a9", + "sha256:2bbdd598ae57bac20968cf9028cc67d37d83bdb7942a94b9478110bc72193148", + "sha256:34586084cdd60845a3e1bece2b58f0a889be25450db8cc0ea143ddf0f40557a2", + "sha256:35957fedbb287b01313bb5c556ffdc70c0277c3500213b5e73dfd8716f748d77", + "sha256:414cb87a40974a575830b406ffab4ab8c6cbd82eeb73abd2a9d1397c1f0223e1", + "sha256:428775be75db68d908b17e4e8dda424c410222f170dc173246aa63e972d094b3", + "sha256:514f670f7d36519bda504d507edfe63e3c20489f86c86d42bc4d9a6dbdf82c7b", + "sha256:5cb962c1ac6887c5da29138fbbe3b4b7705372eb54e599907fa63d4cd743246d", + "sha256:5f6e30282cf70fb7754e1a5f101e27b5240009766376e131b31ab49f14fe81be", + "sha256:86f8e010af6af0b4f42de2d0d9b19cb441e61d3416082186f9dd03c8552d13ad", + "sha256:8d47ed1e557d546bd2dfe54f504d7274274602ff7a0652cde84c258ad6c2d96d", + "sha256:98668876720bce1ac08562d8b93a564a80e3397e442c7ea19cebdcdf73da7f74", + "sha256:9e1f0ddc18d8355dcf5586a5d90417df56074f237812b8682a93b62cca9d2043", + "sha256:a7bc812a72a79d6b7dbb96fa5bee3950464b65ec055d3abc4db6572f2373a95c", + "sha256:b72e13f9f206ee103247b07afd5a39c8b1aa98e8eba80ddba184d030337220ba", + "sha256:bcff8ea9d916789e85e24beed8830c157fb8bc7c313e554733a8151540e66c01", + "sha256:c76e78b3bab652069b8d6f7889b0e72f3455c2b854b2e0a8818393d149ad0a0d" + ], + "markers": "python_version >= '3.5'", + "version": "==0.15.97" + }, "scandir": { "hashes": [ "sha256:2586c94e907d99617887daed6c1d102b5ca28f1085f90446554abf1faf73123e", @@ -598,6 +878,12 @@ "markers": "sys_platform == 'linux'", "version": "==0.8.5" }, + "strictyaml": { + "hashes": [ + "sha256:06d7100587695a0edfabd772a6c6fb69071fc38c413df599e22dfd40e52f5fad" + ], + "version": "==1.0.1" + }, "tap.py": { "hashes": [ "sha256:8ad62ba6898fcef4913c67d468d0c4beae3109b74c03363538145e31b1840b29", @@ -605,6 +891,12 @@ ], "version": "==2.5" }, + "termcolor": { + "hashes": [ + "sha256:1d6d69ce66211143803fbc56652b41d73b4a400a2891d7bf7a1cdf4c02de613b" + ], + "version": "==1.1.0" + }, "toml": { "hashes": [ "sha256:229f81c57791a41d65e399fc06bf0848bab550a9dfd5ed66df18ce5f05e73d5c", @@ -620,6 +912,14 @@ ], "version": "==19.2.0" }, + "tox": { + "hashes": [ + "sha256:f5c8e446b51edd2ea97df31d4ded8c8b72e7d6c619519da6bb6084b9dd5770f9", + "sha256:f87fd33892a2df0950e5e034def9468988b8d008c7e9416be665fcc0dd45b14f" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==3.12.1" + }, "tqdm": { "hashes": [ "sha256:0a860bf2683fdbb4812fe539a6c22ea3f1777843ea985cb8c3807db448a0f7ab", @@ -628,6 +928,13 @@ "markers": "python_version >= '2.6' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==4.32.1" }, + "translationstring": { + "hashes": [ + "sha256:4ee44cfa58c52ade8910ea0ebc3d2d84bdcad9fa0422405b1801ec9b9a65b72d", + "sha256:e26c7bf383413234ed442e0980a2ebe192b95e3745288a8fd2805156d27515b4" + ], + "version": "==1.3" + }, "twine": { "hashes": [ "sha256:0fb0bfa3df4f62076cab5def36b1a71a2e4acb4d1fa5c97475b048117b1a6446", @@ -653,6 +960,13 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3' and python_version < '4'", "version": "==1.25.3" }, + "venusian": { + "hashes": [ + "sha256:2f2d077a1eedc3fda40425f65687c8c494da7e83d7c23bc2c4d1a40eb3ca5b6d", + "sha256:64ec8285b80b110d0ae5db4280e90e31848a59db98db1aba4d7d46f48ce91e3e" + ], + "version": "==1.2.0" + }, "virtualenv": { "hashes": [ "sha256:b7335cddd9260a3dd214b73a2521ffc09647bde3e9457fcca31dc3be3999d04a", @@ -669,6 +983,13 @@ "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", "version": "==0.5.3" }, + "waitress": { + "hashes": [ + "sha256:4e2a6e6fca56d6d3c279f68a2b2cc9b4798d834ea3c3a9db3e2b76b6d66f4526", + "sha256:90fe750cd40b282fae877d3c866255d485de18e8a232e93de42ebd9fb750eebb" + ], + "version": "==1.3.0" + }, "wcwidth": { "hashes": [ "sha256:3df37372226d6e63e1b1e1eda15c594bca98a22d33a23832a90998faa96bc65e", @@ -683,6 +1004,14 @@ ], "version": "==0.5.1" }, + "webob": { + "hashes": [ + "sha256:05aaab7975e0ee8af2026325d656e5ce14a71f1883c52276181821d6d5bf7086", + "sha256:36db8203c67023d68c1b00208a7bf55e3b10de2aa317555740add29c619de12b" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==1.8.5" + }, "werkzeug": { "hashes": [ "sha256:865856ebb55c4dcd0630cdd8f3331a1847a819dda7e8c750d3db6f2aa6c0209c", @@ -698,6 +1027,48 @@ ], "markers": "python_version >= '2.7'", "version": "==0.5.1" + }, + "zope.deprecation": { + "hashes": [ + "sha256:0d453338f04bacf91bbfba545d8bcdf529aa829e67b705eac8c1a7fdce66e2df", + "sha256:f1480b74995958b24ce37b0ef04d3663d2683e5d6debc96726eff18acf4ea113" + ], + "version": "==4.4.0" + }, + "zope.interface": { + "hashes": [ + "sha256:086707e0f413ff8800d9c4bc26e174f7ee4c9c8b0302fbad68d083071822316c", + "sha256:1157b1ec2a1f5bf45668421e3955c60c610e31913cc695b407a574efdbae1f7b", + "sha256:11ebddf765bff3bbe8dbce10c86884d87f90ed66ee410a7e6c392086e2c63d02", + "sha256:14b242d53f6f35c2d07aa2c0e13ccb710392bcd203e1b82a1828d216f6f6b11f", + "sha256:1b3d0dcabc7c90b470e59e38a9acaa361be43b3a6ea644c0063951964717f0e5", + "sha256:20a12ab46a7e72b89ce0671e7d7a6c3c1ca2c2766ac98112f78c5bddaa6e4375", + "sha256:298f82c0ab1b182bd1f34f347ea97dde0fffb9ecf850ecf7f8904b8442a07487", + "sha256:2f6175722da6f23dbfc76c26c241b67b020e1e83ec7fe93c9e5d3dd18667ada2", + "sha256:3b877de633a0f6d81b600624ff9137312d8b1d0f517064dfc39999352ab659f0", + "sha256:4265681e77f5ac5bac0905812b828c9fe1ce80c6f3e3f8574acfb5643aeabc5b", + "sha256:550695c4e7313555549aa1cdb978dc9413d61307531f123558e438871a883d63", + "sha256:5f4d42baed3a14c290a078e2696c5f565501abde1b2f3f1a1c0a94fbf6fbcc39", + "sha256:62dd71dbed8cc6a18379700701d959307823b3b2451bdc018594c48956ace745", + "sha256:7040547e5b882349c0a2cc9b50674b1745db551f330746af434aad4f09fba2cc", + "sha256:7e099fde2cce8b29434684f82977db4e24f0efa8b0508179fce1602d103296a2", + "sha256:7e5c9a5012b2b33e87980cee7d1c82412b2ebabcb5862d53413ba1a2cfde23aa", + "sha256:81295629128f929e73be4ccfdd943a0906e5fe3cdb0d43ff1e5144d16fbb52b1", + "sha256:95cc574b0b83b85be9917d37cd2fad0ce5a0d21b024e1a5804d044aabea636fc", + "sha256:968d5c5702da15c5bf8e4a6e4b67a4d92164e334e9c0b6acf080106678230b98", + "sha256:9e998ba87df77a85c7bed53240a7257afe51a07ee6bc3445a0bf841886da0b97", + "sha256:a0c39e2535a7e9c195af956610dba5a1073071d2d85e9d2e5d789463f63e52ab", + "sha256:a15e75d284178afe529a536b0e8b28b7e107ef39626a7809b4ee64ff3abc9127", + "sha256:a6a6ff82f5f9b9702478035d8f6fb6903885653bff7ec3a1e011edc9b1a7168d", + "sha256:b639f72b95389620c1f881d94739c614d385406ab1d6926a9ffe1c8abbea23fe", + "sha256:bad44274b151d46619a7567010f7cde23a908c6faa84b97598fd2f474a0c6891", + "sha256:bbcef00d09a30948756c5968863316c949d9cedbc7aabac5e8f0ffbdb632e5f1", + "sha256:d788a3999014ddf416f2dc454efa4a5dbeda657c6aba031cf363741273804c6b", + "sha256:eed88ae03e1ef3a75a0e96a55a99d7937ed03e53d0cffc2451c208db445a2966", + "sha256:f99451f3a579e73b5dd58b1b08d1179791d49084371d9a47baad3b22417f0317" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'", + "version": "==4.6.0" } } } diff --git a/news/3809.bugfix.rst b/news/3809.bugfix.rst new file mode 100644 index 0000000000..bd603aaf9d --- /dev/null +++ b/news/3809.bugfix.rst @@ -0,0 +1 @@ +Fixed several bugs which could prevent editable VCS dependencies from being installed into target environments, even when reporting successful installation. diff --git a/news/3810.feature.rst b/news/3810.feature.rst new file mode 100644 index 0000000000..335037790c --- /dev/null +++ b/news/3810.feature.rst @@ -0,0 +1 @@ +Improved verbose logging output during ``pipenv lock`` will now stream output to the console while maintaining a spinner. diff --git a/pipenv/__init__.py b/pipenv/__init__.py index 695a493912..31d49fc1a4 100644 --- a/pipenv/__init__.py +++ b/pipenv/__init__.py @@ -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): diff --git a/pipenv/core.py b/pipenv/core.py index e0df54e375..0991347430 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -1,5 +1,6 @@ # -*- coding=utf-8 -*- from __future__ import absolute_import, print_function +import io import json as simplejson import logging import os @@ -13,7 +14,7 @@ import urllib3.util as urllib3_util import vistir -import click_completion +from click_completion import init as init_completion import delegator import dotenv import pipfile @@ -26,7 +27,8 @@ PIPENV_CACHE_DIR, PIPENV_COLORBLIND, PIPENV_DEFAULT_PYTHON_VERSION, PIPENV_DONT_USE_PYENV, PIPENV_HIDE_EMOJIS, PIPENV_MAX_SUBPROCESS, PIPENV_PYUP_API_KEY, PIPENV_SHELL_FANCY, PIPENV_SKIP_VALIDATION, - PIPENV_YES, SESSION_IS_INTERACTIVE, PIP_EXISTS_ACTION, PIPENV_RESOLVE_VCS + PIPENV_YES, SESSION_IS_INTERACTIVE, PIP_EXISTS_ACTION, PIPENV_RESOLVE_VCS, + is_type_checking ) from .project import Project, SourceNotFound from .utils import ( @@ -39,6 +41,12 @@ ) +if is_type_checking(): + from typing import Dict, List, Mapping, Optional, Union + from pipenv.vendor.requirementslib.models.requirements import Requirement + TSourceDict = Dict[str, Union[str, bool]] + + # Packages that should be ignored later. BAD_PACKAGES = ( "distribute", @@ -73,7 +81,7 @@ INSTALL_LABEL2 = " " STARTING_LABEL = " " # Enable shell completion. -click_completion.init() +init_completion() # Disable colors, for the color blind and others who do not prefer colors. if PIPENV_COLORBLIND: crayons.disable() @@ -737,12 +745,6 @@ def batch_install(deps_list, procs, failed_deps_queue, os.environ["PIP_USER"] = vistir.compat.fs_str("0") if "PYTHONHOME" in os.environ: del os.environ["PYTHONHOME"] - if not install_deps and not environments.PIPENV_RESOLVE_VCS: - link = getattr(dep.req, "link", None) - is_wheel = False - if link: - is_wheel = link.is_wheel - install_deps = dep.is_file_or_url and not (is_wheel or dep.editable) c = pip_install( dep, ignore_hashes=any([ignore_hashes, dep.editable, dep.is_vcs]), @@ -1281,12 +1283,168 @@ def do_init( ) +def get_pip_args( + pre=False, # type: bool + verbose=False, # type: bool, + upgrade=False, # type: bool, + require_hashes=False, # type: bool, + no_build_isolation=False, # type: bool, + no_use_pep517=False, # type: bool, + no_deps=False, # type: bool, + selective_upgrade=False, # type: bool + src_dir=None, # type: Optional[str] +): + # type: (...) -> List[str] + from .vendor.packaging.version import parse as parse_version + arg_map = { + "pre": ["--pre"], + "verbose": ["--verbose"], + "upgrade": ["--upgrade"], + "require_hashes": ["--require-hashes"], + "no_build_isolation": ["--no-build-isolation"], + "no_use_pep517": [], + "no_deps": ["--no-deps"], + "selective_upgrade": [ + "--upgrade-strategy=only-if-needed", "--exists_action={0}".format(PIP_EXISTS_ACTION or "i") + ], + "src_dir": src_dir, + } + if project.environment.pip_version >= parse_version("19.0"): + arg_map["no_use_pep517"].append("--no-use-pep517") + if project.environment.pip_version < parse_version("19.1"): + arg_map["no_use_pep517"].append("--no-build-isolation") + arg_set = [] + for key in arg_map.keys(): + if key in locals() and locals().get(key): + arg_set.extend(arg_map.get(key)) + return list(vistir.misc.dedup(arg_set)) + + +def get_project_index(index=None, trusted_hosts=None): + # type: (Optional[Union[str, TSourceDict]], Optional[List[str]]) -> TSourceDict + from .vendor.urllib3.util import parse_url + if trusted_hosts is None: + trusted_hosts = [] + if isinstance(index, vistir.compat.Mapping): + return index + try: + source = project.find_source(index) + except SourceNotFound: + index_url = parse_url(index) + src_name = project.src_name_from_url(index) + verify_ssl = index_url.host not in trusted_hosts + source = {"url": index, "verify_ssl": verify_ssl, "name": src_name} + return source + + +def get_source_list( + index=None, # type: Optional[Union[str, TSourceDict]] + extra_indexes=None, # type: Optional[List[str]] + trusted_hosts=None, # type: Optional[List[str]] + pypi_mirror=None, # type: Optional[str] +): + # type: (...) -> List[TSourceDict] + sources = [] # type: List[TSourceDict] + if index: + sources.append(get_project_index(index)) + if extra_indexes: + if isinstance(extra_indexes, six.string_types): + extra_indexes = [extra_indexes,] + for source in extra_indexes: + extra_src = get_project_index(source) + if not sources or extra_src["url"] != sources[0]["url"]: + sources.append(extra_src) + else: + for source in project.pipfile_sources: + if not sources or source["url"] != sources[0]["url"]: + sources.append(source) + if not sources: + sources = project.pipfile_sources + if pypi_mirror: + sources = [ + create_mirror_source(pypi_mirror) if is_pypi_url(source["url"]) else source + for source in sources + ] + return sources + + +def get_requirement_line( + requirement, # type: Requirement + src_dir=None, # type: Optional[str] + include_hashes=True, # type: bool + format_for_file=False, # type: bool +): + # type: (...) -> Union[List[str], str] + line = None + if requirement.vcs or requirement.is_file_or_url: + if src_dir and requirement.line_instance.wheel_kwargs: + requirement.line_instance._wheel_kwargs.update({ + "src_dir": src_dir + }) + # if requirement.vcs and requirement.editable: + # repo = requirement.req.get_vcs_repo(src_dir=src_dir) + # requirement.line_instance.vcsrepo + # line = repo.url + # name = requirement.name + # line = "{0}+".format(requirement.vcs) if requirement.vcs else "" + # if requirement.extras: + # name = "{0}{1}".format(name, requirement.extras_as_pip) + # line = "{0}{1}#egg={2}".format( + # line, vistir.path.path_to_url(repo.checkout_directory), requirement.name + # ) + # if repo.subdirectory: + # line = "{0}&subdirectory={1}".format(line, repo.subdirectory) + # else: + line = requirement.line_instance.line + if requirement.line_instance.markers: + line = '{0}; {1}'.format(line, requirement.line_instance.markers) + if not format_for_file: + line = '"{0}"'.format(line) + if requirement.editable: + if not format_for_file: + return ["-e", line] + return '-e {0}'.format(line) + if not format_for_file: + return [line,] + return line + return requirement.as_line(include_hashes=include_hashes, as_list=not format_for_file) + + +def write_requirement_to_file( + requirement, # type: Requirement + requirements_dir=None, # type: Optional[str] + src_dir=None, # type: Optional[str] + include_hashes=True # type: bool +): + # type: (...) -> str + if not requirements_dir: + requirements_dir = vistir.path.create_tracked_tempdir( + prefix="pipenv", suffix="requirements") + line = get_requirement_line( + requirement, src_dir, include_hashes=include_hashes, format_for_file=True + ) + + f = vistir.compat.NamedTemporaryFile( + prefix="pipenv-", suffix="-requirement.txt", dir=requirements_dir, + delete=False + ) + if environments.is_verbose(): + click.echo( + "Writing supplied requirement line to temporary file: {0!r}".format(line), + err=True + ) + f.write(vistir.misc.to_bytes(line)) + r = f.name + f.close() + return r + + def pip_install( requirement=None, r=None, allow_global=False, ignore_hashes=False, - no_deps=True, + no_deps=None, block=True, index=None, pre=False, @@ -1298,18 +1456,38 @@ def pip_install( use_pep517=True ): from pipenv.patched.notpip._internal import logger as piplogger - from .vendor.vistir.compat import Mapping - from .vendor.urllib3.util import parse_url - src = [] - write_to_tmpfile = False - if requirement: - needs_hashes = not requirement.editable and not ignore_hashes and r is None - has_subdir = requirement.is_vcs and requirement.req.subdirectory - write_to_tmpfile = needs_hashes or has_subdir - + src_dir = None if not trusted_hosts: trusted_hosts = [] + trusted_hosts.extend(os.environ.get("PIP_TRUSTED_HOSTS", [])) + if not allow_global: + src_dir = project.virtualenv_src_location + # src_dir = os.getenv("PIP_SRC", os.getenv("PIP_SRC_DIR", project.virtualenv_src_location)) + else: + src_dir = os.getenv("PIP_SRC", os.getenv("PIP_SRC_DIR")) + if requirement: + if requirement.editable or not requirement.hashes: + ignore_hashes = True + elif not (requirement.is_vcs or requirement.editable or requirement.vcs): + ignore_hashes = False + line = None + if requirement.vcs and not requirement.line_instance.markers: + line = get_requirement_line(requirement, src_dir, include_hashes=not ignore_hashes, format_for_file=False) + else: + r = write_requirement_to_file( + requirement, requirements_dir=requirements_dir, src_dir=src_dir, + include_hashes=not ignore_hashes + ) + # Try installing for each source in project.sources. + sources = get_source_list( + index, extra_indexes=extra_indexes, trusted_hosts=trusted_hosts, + pypi_mirror=pypi_mirror + ) + if r: + with io.open(r, "r") as fh: + if "--hash" not in fh.read(): + ignore_hashes = True if environments.is_verbose(): piplogger.setLevel(logging.INFO) if requirement: @@ -1318,214 +1496,52 @@ def pip_install( err=True, ) - if requirement: - ignore_hashes = True if not requirement.hashes else ignore_hashes - - # Create files for hash mode. - if write_to_tmpfile: - if not requirements_dir: - requirements_dir = vistir.path.create_tracked_tempdir( - prefix="pipenv", suffix="requirements") - f = vistir.compat.NamedTemporaryFile( - prefix="pipenv-", suffix="-requirement.txt", dir=requirements_dir, - delete=False - ) - line = requirement.as_line(include_hashes=not ignore_hashes) - if environments.is_verbose(): - click.echo( - "Writing requirement line to temporary file: {0!r}".format(line), - err=True - ) - f.write(vistir.misc.to_bytes(line)) - r = f.name - f.close() - if requirement and requirement.vcs: # Install dependencies when a package is a non-editable VCS dependency. # Don't specify a source directory when using --system. - if not allow_global and ("PIP_SRC" not in os.environ): - src.extend(["--src", "{0}".format(project.virtualenv_src_location)]) - - # Try installing for each source in project.sources. - if index: - if isinstance(index, (Mapping, dict)): - index_source = index - else: - try: - index_source = project.find_source(index) - index_source = index_source.copy() - except SourceNotFound: - src_name = project.src_name_from_url(index) - index_url = parse_url(index) - verify_ssl = index_url.host not in trusted_hosts - index_source = {"url": index, "verify_ssl": verify_ssl, "name": src_name} - sources = [index_source.copy(),] - if extra_indexes: - if isinstance(extra_indexes, six.string_types): - extra_indexes = [extra_indexes,] - for idx in extra_indexes: - extra_src = None - if isinstance(idx, (Mapping, dict)): - extra_src = idx - try: - extra_src = project.find_source(idx) if not extra_src else extra_src - except SourceNotFound: - src_name = project.src_name_from_url(idx) - src_url = parse_url(idx) - verify_ssl = src_url.host not in trusted_hosts - extra_src = {"url": idx, "verify_ssl": verify_ssl, "name": extra_src} - if extra_src["url"] != index_source["url"]: - sources.append(extra_src) - else: - for idx in project.pipfile_sources: - if idx["url"] != sources[0]["url"]: - sources.append(idx) - else: - sources = project.pipfile_sources - if pypi_mirror: - sources = [ - create_mirror_source(pypi_mirror) if is_pypi_url(source["url"]) else source - for source in sources - ] - - line_kwargs = {"as_list": True, "include_hashes": not ignore_hashes} - - # Install dependencies when a package is a VCS dependency. - if requirement and requirement.vcs: - ignore_hashes = True - # Don't specify a source directory when using --system. - src_dir = None - if "PIP_SRC" in os.environ: - src_dir = os.environ["PIP_SRC"] - src = ["--src", os.environ["PIP_SRC"]] - if not requirement.editable and not environments.PIPENV_RESOLVE_VCS: + if not requirement.editable and no_deps is not True: # Leave this off becauase old lockfiles don't have all deps included # TODO: When can it be turned back on? no_deps = False - - if src_dir is not None: - if environments.is_verbose(): - click.echo("Using source directory: {0!r}".format(src_dir)) - repo = requirement.req.get_vcs_repo(src_dir=src_dir) - else: - repo = requirement.req.get_vcs_repo() - write_to_tmpfile = True - line_kwargs["include_markers"] = False - line_kwargs["include_hashes"] = False - if not requirements_dir: - requirements_dir = vistir.path.create_tracked_tempdir(prefix="pipenv", - suffix="requirements") - f = vistir.compat.NamedTemporaryFile( - prefix="pipenv-", suffix="-requirement.txt", dir=requirements_dir, - delete=False - ) - line = "-e " if requirement.editable else "" - if requirement.editable or requirement.name is not None: - name = requirement.name - if requirement.extras: - name = "{0}{1}".format(name, requirement.extras_as_pip) - line = "{0}{1}#egg={2}".format( - line, vistir.path.path_to_url(repo.checkout_directory), requirement.name - ) - if repo.subdirectory: - line = "{0}&subdirectory={1}".format(line, repo.subdirectory) - else: - line = requirement.as_line(**line_kwargs) - if environments.is_verbose(): - click.echo( - "Writing requirement line to temporary file: {0!r}".format(line), - err=True - ) - f.write(vistir.misc.to_bytes(line)) - r = f.name - f.close() - - # Create files for hash mode. - if write_to_tmpfile and not r: - if not requirements_dir: - requirements_dir = vistir.path.create_tracked_tempdir( - prefix="pipenv", suffix="requirements") - f = vistir.compat.NamedTemporaryFile( - prefix="pipenv-", suffix="-requirement.txt", dir=requirements_dir, - delete=False - ) - ignore_hashes = True if not requirement.hashes else ignore_hashes - line = requirement.as_line(include_hashes=not ignore_hashes) - line = "{0} {1}".format(line, " ".join(src)) - if environments.is_verbose(): - click.echo( - "Writing requirement line to temporary file: {0!r}".format(line), - err=True - ) - f.write(vistir.misc.to_bytes(line)) - r = f.name - f.close() - - if (requirement and requirement.editable) and not r: - line_kwargs["include_markers"] = False - line_kwargs["include_hashes"] = False - install_reqs = requirement.as_line(**line_kwargs) - if requirement.editable and install_reqs[0].startswith("-e "): - req, install_reqs = install_reqs[0], install_reqs[1:] - possible_hashes = install_reqs[:] - editable_opt, req = req.split(" ", 1) - install_reqs = [editable_opt, req] + install_reqs - - # hashes must be passed via a file - ignore_hashes = True - elif r: - install_reqs = ["-r", r] - with open(r) as f: - if "--hash" not in f.read(): - ignore_hashes = True - else: - ignore_hashes = True if not requirement.hashes else ignore_hashes - install_reqs = requirement.as_line(as_list=True, include_hashes=not ignore_hashes) - if not requirement.markers: - install_reqs = [escape_cmd(r) for r in install_reqs] - elif len(install_reqs) > 1: - install_reqs = install_reqs[0] + [escape_cmd(r) for r in install_reqs[1:]] + elif requirement.editable and no_deps is None: + no_deps = True pip_command = [which_pip(allow_global=allow_global), "install"] - if pre: - pip_command.append("--pre") - if src: - pip_command.extend(src) - if environments.is_verbose(): - pip_command.append("--verbose") - pip_command.append("--upgrade") - if selective_upgrade: - pip_command.append("--upgrade-strategy=only-if-needed") - if no_deps: - pip_command.append("--no-deps") - pip_command.extend(install_reqs) + pip_args = get_pip_args( + pre=pre, verbose=environments.is_verbose(), upgrade=True, + selective_upgrade=selective_upgrade, no_use_pep517=not use_pep517, + no_deps=no_deps, require_hashes=not ignore_hashes + ) + pip_command.extend(pip_args) + if r: + pip_command.extend(["-r", r]) + elif line: + pip_command.extend(line) pip_command.extend(prepare_pip_source_args(sources)) - if not ignore_hashes: - pip_command.append("--require-hashes") - if not use_pep517: - from .vendor.packaging.version import parse as parse_version - pip_command.append("--no-build-isolation") - if project.environment.pip_version >= parse_version("19.0"): - pip_command.append("--no-use-pep517") if environments.is_verbose(): click.echo("$ {0}".format(pip_command), err=True) cache_dir = vistir.compat.Path(PIPENV_CACHE_DIR) + DEFAULT_EXISTS_ACTION = "w" + if selective_upgrade: + DEFAULT_EXISTS_ACTION = "i" + exists_action = vistir.misc.fs_str(PIP_EXISTS_ACTION or DEFAULT_EXISTS_ACTION) pip_config = { "PIP_CACHE_DIR": vistir.misc.fs_str(cache_dir.as_posix()), "PIP_WHEEL_DIR": vistir.misc.fs_str(cache_dir.joinpath("wheels").as_posix()), "PIP_DESTINATION_DIR": vistir.misc.fs_str( cache_dir.joinpath("pkgs").as_posix() ), - "PIP_EXISTS_ACTION": vistir.misc.fs_str(PIP_EXISTS_ACTION or "w"), + "PIP_EXISTS_ACTION": exists_action, "PATH": vistir.misc.fs_str(os.environ.get("PATH")), } - if src: + if src_dir: + if environments.is_verbose(): + click.echo("Using source directory: {0!r}".format(src_dir), err=True) pip_config.update( - {"PIP_SRC": vistir.misc.fs_str(project.virtualenv_src_location)} + {"PIP_SRC": vistir.misc.fs_str(src_dir)} ) cmd = Script.parse(pip_command) pip_command = cmd.cmdify() c = None - # with project.environment.activated(): c = delegator.run(pip_command, block=block, env=pip_config) return c @@ -2091,57 +2107,60 @@ def do_install( pkg_requirement = Requirement.from_line(pkg_line) except ValueError as e: sp.write_err(vistir.compat.fs_str("{0}: {1}".format(crayons.red("WARNING"), e))) - sp.fail(environments.PIPENV_SPINNER_FAIL_TEXT.format("Installation Failed")) + sp.red.fail(environments.PIPENV_SPINNER_FAIL_TEXT.format("Installation Failed")) sys.exit(1) if index_url: pkg_requirement.index = index_url - deps = [] - if pkg_requirement.is_vcs and PIPENV_RESOLVE_VCS: - deps = pkg_requirement.req.dependencies - to_install = [pkg_requirement,] + # deps = [] + # if pkg_requirement.is_vcs and PIPENV_RESOLVE_VCS: + # if not allow_global and ( + # pkg_requirement.line_instance and pkg_requirement.line_instance.wheel_kwargs + # ): + # pkg_requirement.line_instance._wheel_kwargs["src_dir"] = project.virtualenv_src_location + # pkg_setupinfo = pkg_requirement.line_instance.setup_info + # deps = pkg_setupinfo.requires no_deps = False sp.text = "Installing..." try: - if deps: - to_install.extend([ - Requirement.from_line(d) for d in list(deps[0].values()) - ]) - no_deps = True - for dep in to_install: - sp.text = "Installing {0}...".format(dep.name) - c = pip_install( - dep, - ignore_hashes=True, - allow_global=system, - selective_upgrade=selective_upgrade, - no_deps=no_deps, - pre=pre, - requirements_dir=requirements_directory, - index=index_url, - extra_indexes=extra_index_url, - pypi_mirror=pypi_mirror, - ) - if not c.ok: - sp.write_err(vistir.compat.fs_str( - "{0}: {1}".format( - crayons.red("WARNING"), - "Failed installing package {0}".format(pkg_line) - ), - )) - sp.write_err(vistir.compat.fs_str( - "Error text: {0}".format(c.out) - )) - raise RuntimeError(c.err) - if environments.is_verbose(): - click.echo(crayons.blue(format_pip_output(c.out))) + sp.text = "Installing {0}...".format(pkg_requirement.name) + if environments.is_verbose(): + sp.hide_and_write("Installing package: {0}".format(pkg_requirement.as_line(include_hashes=False))) + c = pip_install( + pkg_requirement, + ignore_hashes=True, + allow_global=system, + selective_upgrade=selective_upgrade, + no_deps=no_deps, + pre=pre, + requirements_dir=requirements_directory, + index=index_url, + extra_indexes=extra_index_url, + pypi_mirror=pypi_mirror, + ) + if not c.ok: + sp.write_err(vistir.compat.fs_str( + "{0}: {1}".format( + crayons.red("WARNING"), + "Failed installing package {0}".format(pkg_line) + ), + )) + sp.write_err(vistir.compat.fs_str( + "Error text: {0}".format(c.out) + )) + sp.write_err(vistir.compat.fs_str( + "{0}".format(c.err) + )) + raise RuntimeError(c.err) + if environments.is_verbose(): + click.echo(crayons.blue(format_pip_output(c.out))) except (ValueError, RuntimeError) as e: sp.write_err(vistir.compat.fs_str( "{0}: {1}".format(crayons.red("WARNING"), e), )) - sp.fail(environments.PIPENV_SPINNER_FAIL_TEXT.format( + sp.red.fail(environments.PIPENV_SPINNER_FAIL_TEXT.format( "Installation Failed", )) - sys.exit(1) + # sys.exit(1) # Warn if --editable wasn't passed. if pkg_requirement.is_vcs and not pkg_requirement.editable and not PIPENV_RESOLVE_VCS: sp.write_err( @@ -2182,7 +2201,7 @@ def do_install( # Add the package to the Pipfile. try: project.add_package_to_pipfile(pkg_requirement, dev) - except ValueError as e: + except ValueError: import traceback sp.write_err( "{0} {1}".format( diff --git a/pipenv/utils.py b/pipenv/utils.py index 18c7dd0142..cfda803a28 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -965,10 +965,6 @@ def actually_resolve_deps( ): from pipenv.vendor.vistir.path import create_tracked_tempdir from pipenv.vendor.requirementslib.models.requirements import Requirement - import pipenv.patched.piptools.logging - - if environments.is_verbose(): - pipenv.patched.piptools.logging.log.verbosity = 1 if not req_dir: req_dir = create_tracked_tempdir(suffix="-requirements", prefix="pipenv-") @@ -1022,17 +1018,21 @@ def resolve(cmd, sp): result = None try: result = c.expect(u"\n", timeout=environments.PIPENV_INSTALL_TIMEOUT) - except (EOF, TIMEOUT): + except TIMEOUT: pass - _out = c.subprocess.before - if _out: - _out = decode_output("{0}\n".format(_out)) + except EOF: + break + except KeyboardInterrupt: + c.kill() + break + if result: + _out = c.subprocess.before + _out = decode_output("{0}".format(_out)) out += _out - sp.text = to_native_string("{0}".format(_out[:100])) + # sp.text = to_native_string("{0}".format(_out[:100])) if environments.is_verbose(): - sp.hide_and_write(_out.rstrip()) - _out = to_native_string("") - if not result and not _out: + sp.hide_and_write(out.splitlines()[-1].rstrip()) + else: break c.block() if c.return_code != 0: @@ -1042,11 +1042,9 @@ def resolve(cmd, sp): echo(c.out.strip(), err=True) if not environments.is_verbose(): echo(out, err=True) - echo(c.err.strip(), err=True) sys.exit(c.return_code) if environments.is_verbose(): - for ln in c.err.strip(): - sp.hide_and_write(ln) + echo(c.err.strip(), err=True) return c diff --git a/pytest.ini b/pytest.ini index 61b492e331..8bbd020839 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,5 +1,6 @@ [pytest] addopts = -ra -n auto +plugins = pytest_devpi_server xdist testpaths = tests ; Add vendor and patched in addition to the default list of ignored dirs ; Additionally, ignore tasks, news, test subdirectories and peeps directory diff --git a/setup.py b/setup.py index d262eb354d..178b3d3a91 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ "parver", "invoke", ], - "tests": ["pytest", "pytest-tap", "pytest-xdist", "flaky", "mock"], + "tests": ["pytest", "pytest-devpi-server", "pytest-tap", "pytest-xdist", "flaky", "mock"], } # https://pypi.python.org/pypi/stdeb/0.8.5#quickstart-2-just-tell-me-the-fastest-way-to-make-a-deb diff --git a/tasks/release.py b/tasks/release.py index dc76a5f175..375d73020c 100644 --- a/tasks/release.py +++ b/tasks/release.py @@ -129,7 +129,7 @@ def build_dists(ctx): log('Building sdist using %s ....' % executable) os.environ["PIPENV_PYTHON"] = py_version ctx.run('pipenv install --dev', env=env) - ctx.run('pipenv run pip install -e . --upgrade --upgrade-strategy=eager --no-use-pep517', env=env) + ctx.run('pipenv run pip install -e . --upgrade --upgrade-strategy=eager', env=env) log('Building wheel using python %s ....' % py_version) if py_version == '3.6': ctx.run('pipenv run python setup.py sdist bdist_wheel', env=env) diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 0f20261483..e7c720b391 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -7,21 +7,23 @@ import sys import warnings -from shutil import rmtree as _rmtree +from shutil import copyfileobj, rmtree as _rmtree import pytest +import requests -from vistir.compat import ResourceWarning, fs_str, fs_encode, FileNotFoundError, PermissionError, TemporaryDirectory -from vistir.misc import run -from vistir.contextmanagers import temp_environ -from vistir.path import mkdir_p, create_tracked_tempdir, handle_remove_readonly +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, open_file +from pipenv.vendor.vistir.path import mkdir_p, create_tracked_tempdir, handle_remove_readonly from pipenv._compat import Path from pipenv.cmdparse import Script from pipenv.exceptions import VirtualenvActivationException from pipenv.vendor import delegator, requests, toml, tomlkit from pytest_pypi.app import prepare_fixtures -from pytest_pypi.app import prepare_packages as prepare_pypi_packages +from pytest_shutil.workspace import Workspace +from _pytest_devpi_server import DevpiServer warnings.simplefilter("default", category=ResourceWarning) @@ -93,10 +95,21 @@ def check_for_mercurial(): TESTS_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) PYPI_VENDOR_DIR = os.path.join(TESTS_ROOT, 'pypi') WE_HAVE_HG = check_for_mercurial() -prepare_pypi_packages(PYPI_VENDOR_DIR) prepare_fixtures(os.path.join(PYPI_VENDOR_DIR, "fixtures")) +@pytest.fixture(scope="session") +def pipenv_devpi_server(): + with DevpiServer(offline=False) as server: + server.start() + server.api("index", "-c", "pipenv", "bases=root/pypi", "volatile=False") + server.index = "pipenv" + for path in Path(PYPI_VENDOR_DIR).iterdir(): + if path.is_dir(): + server.api("upload", "--from-dir", path.as_posix()) + yield server + + def pytest_runtest_setup(item): if item.get_closest_marker('needs_internet') is not None and not WE_HAVE_INTERNET: pytest.skip('requires internet') @@ -257,11 +270,12 @@ def get_url(cls, pkg=None, filename=None): file_path = os.path.join(pkg, filename) if filename and not pkg: pkg = os.path.basename(filename) - if pypi: + fixture_pypi = os.getenv("ARTIFACT_PYPI_URL") + if fixture_pypi: if pkg and not filename: - url = "{0}/artifacts/{1}".format(pypi, pkg) + url = "{0}/artifacts/{1}".format(fixture_pypi, pkg) else: - url = "{0}/artifacts/{1}/{2}".format(pypi, pkg, filename) + url = "{0}/artifacts/{1}/{2}".format(fixture_pypi, pkg, filename) return url if pkg and not filename: return cls.get_fixture_path(file_path).as_uri() @@ -273,7 +287,13 @@ def __init__( self, pypi=None, pipfile=True, chdir=False, path=None, home_dir=None, venv_root=None, ignore_virtualenvs=True, venv_in_project=True, name=None ): - self.pypi = pypi + self.index_url = os.getenv("PIPENV_TEST_INDEX") + self.pypi = None + if pypi: + self.pypi = pypi.url + elif self.index_url is not None: + self.pypi, _, _ = self.index_url.rpartition("/") if self.index_url else "" + self.index = os.getenv("PIPENV_PYPI_INDEX") os.environ["PYTHONWARNINGS"] = "ignore:DEPRECATION" if ignore_virtualenvs: os.environ["PIPENV_IGNORE_VIRTUALENVS"] = fs_str("1") @@ -312,8 +332,9 @@ def __init__( self.chdir = chdir if self.pypi: - os.environ['PIPENV_PYPI_URL'] = fs_str('{0}'.format(self.pypi.url)) - os.environ['PIPENV_TEST_INDEX'] = fs_str('{0}/simple'.format(self.pypi.url)) + os.environ['PIPENV_PYPI_URL'] = fs_str('{0}'.format(self.pypi)) + # os.environ['PIPENV_PYPI_URL'] = fs_str('{0}'.format(self.pypi.url)) + # os.environ['PIPENV_TEST_INDEX'] = fs_str('{0}/simple'.format(self.pypi.url)) if pipfile: p_path = os.sep.join([self.path, 'Pipfile']) @@ -401,13 +422,28 @@ def _rmtree_func(path, ignore_errors=True, onerror=None): @pytest.fixture() -def PipenvInstance(monkeypatch): +def pip_src_dir(request, vistir_tmpdir): + old_src_dir = os.environ.get('PIP_SRC', '') + os.environ['PIP_SRC'] = vistir_tmpdir.as_posix() + + def finalize(): + os.environ['PIP_SRC'] = fs_str(old_src_dir) + + request.addfinalizer(finalize) + return request + + +@pytest.fixture() +def PipenvInstance(pip_src_dir, monkeypatch, pipenv_devpi_server, pypi): with temp_environ(), monkeypatch.context() as m: m.setattr(shutil, "rmtree", _rmtree_func) original_umask = os.umask(0o007) os.environ["PIPENV_NOSPIN"] = fs_str("1") os.environ["CI"] = fs_str("1") os.environ['PIPENV_DONT_USE_PYENV'] = fs_str('1') + os.environ["PIPENV_TEST_INDEX"] = "{0}/{1}/{2}/+simple".format(pipenv_devpi_server.uri, pipenv_devpi_server.user, pipenv_devpi_server.index) + os.environ["PIPENV_PYPI_INDEX"] = pipenv_devpi_server.index + os.environ["ARTIFACT_PYPI_URL"] = pypi.url warnings.simplefilter("ignore", category=ResourceWarning) warnings.filterwarnings("ignore", category=ResourceWarning, message="unclosed.*") try: @@ -416,16 +452,20 @@ def PipenvInstance(monkeypatch): os.umask(original_umask) -@pytest.fixture(autouse=True) -def pip_src_dir(request, vistir_tmpdir): - old_src_dir = os.environ.get('PIP_SRC', '') - os.environ['PIP_SRC'] = vistir_tmpdir.as_posix() - - def finalize(): - os.environ['PIP_SRC'] = fs_str(old_src_dir) - - request.addfinalizer(finalize) - return request +@pytest.fixture() +def PipenvInstance_NoPyPI(monkeypatch, pip_src_dir): + with temp_environ(), monkeypatch.context() as m: + m.setattr(shutil, "rmtree", _rmtree_func) + original_umask = os.umask(0o007) + os.environ["PIPENV_NOSPIN"] = fs_str("1") + os.environ["CI"] = fs_str("1") + os.environ['PIPENV_DONT_USE_PYENV'] = fs_str('1') + warnings.simplefilter("ignore", category=ResourceWarning) + warnings.filterwarnings("ignore", category=ResourceWarning, message="unclosed.*") + try: + yield _PipenvInstance + finally: + os.umask(original_umask) @pytest.fixture() diff --git a/tests/integration/test_cli.py b/tests/integration/test_cli.py index 6153658dad..a682d0dda2 100644 --- a/tests/integration/test_cli.py +++ b/tests/integration/test_cli.py @@ -14,8 +14,8 @@ @pytest.mark.cli -def test_pipenv_where(PipenvInstance, pypi_secure): - with PipenvInstance(pypi=pypi_secure) as p: +def test_pipenv_where(PipenvInstance): + with PipenvInstance() as p: c = p.pipenv("--where") assert c.ok assert normalize_drive(p.path) in c.out @@ -82,8 +82,8 @@ def test_pipenv_rm(PipenvInstance): @pytest.mark.cli -def test_pipenv_graph(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_pipenv_graph(PipenvInstance): + with PipenvInstance() as p: c = p.pipenv('install requests') assert c.ok graph = p.pipenv("graph") @@ -98,8 +98,8 @@ def test_pipenv_graph(PipenvInstance, pypi): @pytest.mark.cli -def test_pipenv_graph_reverse(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_pipenv_graph_reverse(PipenvInstance): + with PipenvInstance() as p: c = p.pipenv('install requests==2.18.4') assert c.ok c = p.pipenv('graph --reverse') @@ -128,8 +128,8 @@ def test_pipenv_graph_reverse(PipenvInstance, pypi): @pytest.mark.cli @pytest.mark.needs_internet(reason='required by check') @flaky -def test_pipenv_check(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_pipenv_check(PipenvInstance): + with PipenvInstance() as p: p.pipenv('install requests==1.0.0') c = p.pipenv('check') assert c.return_code != 0 @@ -197,8 +197,8 @@ def test_man(PipenvInstance): @pytest.mark.cli -def test_install_parse_error(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_install_parse_error(PipenvInstance): + with PipenvInstance() as p: # Make sure unparseable packages don't wind up in the pipfile # Escape $ for shell input @@ -219,21 +219,21 @@ def test_install_parse_error(PipenvInstance, pypi): @pytest.mark.unused @pytest.mark.skip_osx @pytest.mark.needs_internet(reason='required by check') -def test_check_unused(PipenvInstance, pypi): - with PipenvInstance(chdir=True, pypi=pypi) as p: +def test_check_unused(PipenvInstance): + with PipenvInstance(chdir=True) as p: with open('__init__.py', 'w') as f: contents = """ -import tablib +import fake_package import records import flask """.strip() f.write(contents) - p.pipenv('install requests tablib flask') + p.pipenv('install requests fake_package flask') - assert all(pkg in p.pipfile['packages'] for pkg in ['requests', 'tablib', 'flask']) + assert all(pkg in p.pipfile['packages'] for pkg in ['requests', 'fake_package', 'flask']) c = p.pipenv('check --unused .') - assert 'tablib' not in c.out + assert 'fake_package' not in c.out assert 'flask' not in c.out diff --git a/tests/integration/test_dot_venv.py b/tests/integration/test_dot_venv.py index 840560f910..aa52dd5eab 100644 --- a/tests/integration/test_dot_venv.py +++ b/tests/integration/test_dot_venv.py @@ -11,10 +11,10 @@ @pytest.mark.dotvenv -def test_venv_in_project(PipenvInstance, pypi): +def test_venv_in_project(PipenvInstance): with temp_environ(): os.environ['PIPENV_VENV_IN_PROJECT'] = '1' - with PipenvInstance(pypi=pypi) as p: + with PipenvInstance() as p: c = p.pipenv('install requests') assert c.return_code == 0 assert normalize_drive(p.path) in p.pipenv('--venv').out @@ -36,8 +36,8 @@ def test_venv_at_project_root(PipenvInstance): @pytest.mark.dotvenv -def test_reuse_previous_venv(PipenvInstance, pypi): - with PipenvInstance(chdir=True, pypi=pypi) as p: +def test_reuse_previous_venv(PipenvInstance): + with PipenvInstance(chdir=True) as p: os.mkdir('.venv') c = p.pipenv('install requests') assert c.return_code == 0 @@ -46,11 +46,11 @@ def test_reuse_previous_venv(PipenvInstance, pypi): @pytest.mark.dotvenv @pytest.mark.parametrize('venv_name', ('test-venv', os.path.join('foo', 'test-venv'))) -def test_venv_file(venv_name, PipenvInstance, pypi): +def test_venv_file(venv_name, PipenvInstance): """Tests virtualenv creation when a .venv file exists at the project root and contains a venv name. """ - with PipenvInstance(pypi=pypi, chdir=True) as p: + with PipenvInstance(chdir=True) as p: file_path = os.path.join(p.path, '.venv') with open(file_path, 'w') as f: f.write(venv_name) @@ -79,11 +79,11 @@ def test_venv_file(venv_name, PipenvInstance, pypi): @pytest.mark.dotvenv -def test_venv_file_with_path(PipenvInstance, pypi): +def test_venv_file_with_path(PipenvInstance): """Tests virtualenv creation when a .venv file exists at the project root and contains an absolute path. """ - with temp_environ(), PipenvInstance(chdir=True, pypi=pypi) as p: + with temp_environ(), PipenvInstance(chdir=True) as p: with TemporaryDirectory( prefix='pipenv-', suffix='-test_venv' ) as venv_path: diff --git a/tests/integration/test_install_basic.py b/tests/integration/test_install_basic.py index ea6efb3ed2..4fb936b9dd 100644 --- a/tests/integration/test_install_basic.py +++ b/tests/integration/test_install_basic.py @@ -14,8 +14,8 @@ @pytest.mark.install @pytest.mark.setup -def test_basic_setup(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_basic_setup(PipenvInstance): + with PipenvInstance() as p: with PipenvInstance(pipfile=False) as p: c = p.pipenv("install requests") assert c.return_code == 0 @@ -31,8 +31,8 @@ def test_basic_setup(PipenvInstance, pypi): @flaky @pytest.mark.install @pytest.mark.skip_osx -def test_basic_install(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_basic_install(PipenvInstance): + with PipenvInstance() as p: c = p.pipenv("install requests") assert c.return_code == 0 assert "requests" in p.pipfile["packages"] @@ -45,8 +45,8 @@ def test_basic_install(PipenvInstance, pypi): @flaky @pytest.mark.install -def test_mirror_install(PipenvInstance, pypi): - with temp_environ(), PipenvInstance(chdir=True, pypi=pypi) as p: +def test_mirror_install(PipenvInstance): + with temp_environ(), PipenvInstance(chdir=True) as p: mirror_url = os.environ.pop( "PIPENV_TEST_INDEX", "https://pypi.python.org/simple" ) @@ -72,7 +72,7 @@ def test_mirror_install(PipenvInstance, pypi): @flaky @pytest.mark.install @pytest.mark.needs_internet -def test_bad_mirror_install(PipenvInstance, pypi): +def test_bad_mirror_install(PipenvInstance): with temp_environ(), PipenvInstance(chdir=True) as p: # This demonstrates that the mirror parameter is being used os.environ.pop("PIPENV_TEST_INDEX", None) @@ -83,8 +83,8 @@ def test_bad_mirror_install(PipenvInstance, pypi): @pytest.mark.lock @pytest.mark.complex @pytest.mark.skip(reason="Does not work unless you can explicitly install into py2") -def test_complex_lock(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_complex_lock(PipenvInstance): + with PipenvInstance() as p: c = p.pipenv("install apscheduler") assert c.return_code == 0 assert "apscheduler" in p.pipfile["packages"] @@ -95,8 +95,8 @@ def test_complex_lock(PipenvInstance, pypi): @flaky @pytest.mark.dev @pytest.mark.run -def test_basic_dev_install(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_basic_dev_install(PipenvInstance): + with PipenvInstance() as p: c = p.pipenv("install requests --dev") assert c.return_code == 0 assert "requests" in p.pipfile["dev-packages"] @@ -113,9 +113,9 @@ def test_basic_dev_install(PipenvInstance, pypi): @flaky @pytest.mark.dev @pytest.mark.install -def test_install_without_dev(PipenvInstance, pypi): +def test_install_without_dev(PipenvInstance): """Ensure that running `pipenv install` doesn't install dev packages""" - with PipenvInstance(pypi=pypi, chdir=True) as p: + with PipenvInstance(chdir=True) as p: with open(p.pipfile_path, "w") as f: contents = """ [packages] @@ -139,8 +139,8 @@ def test_install_without_dev(PipenvInstance, pypi): @flaky @pytest.mark.install -def test_install_without_dev_section(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_install_without_dev_section(PipenvInstance): + with PipenvInstance() as p: with open(p.pipfile_path, "w") as f: contents = """ [packages] @@ -160,8 +160,8 @@ def test_install_without_dev_section(PipenvInstance, pypi): @flaky @pytest.mark.extras @pytest.mark.install -def test_extras_install(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_extras_install(PipenvInstance): + with PipenvInstance(chdir=True) as p: c = p.pipenv("install requests[socks]") assert c.return_code == 0 assert "requests" in p.pipfile["packages"] @@ -177,8 +177,8 @@ def test_extras_install(PipenvInstance, pypi): @flaky @pytest.mark.pin @pytest.mark.install -def test_windows_pinned_pipfile(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_windows_pinned_pipfile(PipenvInstance): + with PipenvInstance() as p: with open(p.pipfile_path, "w") as f: contents = """ [packages] @@ -195,8 +195,8 @@ def test_windows_pinned_pipfile(PipenvInstance, pypi): @pytest.mark.install @pytest.mark.resolver @pytest.mark.backup_resolver -def test_backup_resolver(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_backup_resolver(PipenvInstance): + with PipenvInstance() as p: with open(p.pipfile_path, "w") as f: contents = """ [packages] @@ -212,8 +212,8 @@ def test_backup_resolver(PipenvInstance, pypi): @flaky @pytest.mark.run @pytest.mark.alt -def test_alternative_version_specifier(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_alternative_version_specifier(PipenvInstance): + with PipenvInstance() as p: with open(p.pipfile_path, "w") as f: contents = """ [packages] @@ -237,8 +237,8 @@ def test_alternative_version_specifier(PipenvInstance, pypi): @flaky @pytest.mark.run @pytest.mark.alt -def test_outline_table_specifier(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_outline_table_specifier(PipenvInstance): + with PipenvInstance() as p: with open(p.pipfile_path, "w") as f: contents = """ [packages.requests] @@ -261,8 +261,8 @@ def test_outline_table_specifier(PipenvInstance, pypi): @pytest.mark.bad @pytest.mark.install -def test_bad_packages(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_bad_packages(PipenvInstance): + with PipenvInstance() as p: c = p.pipenv("install NotAPackage") assert c.return_code > 0 @@ -271,9 +271,9 @@ def test_bad_packages(PipenvInstance, pypi): @pytest.mark.install @pytest.mark.requirements @pytest.mark.skip(reason="Not mocking this.") -def test_requirements_to_pipfile(PipenvInstance, pypi): +def test_requirements_to_pipfile(PipenvInstance): - with PipenvInstance(pipfile=False, chdir=True, pypi=pypi) as p: + with PipenvInstance(pipfile=False, chdir=True) as p: # Write a requirements file with open("requirements.txt", "w") as f: @@ -300,13 +300,13 @@ def test_requirements_to_pipfile(PipenvInstance, pypi): @pytest.mark.install @pytest.mark.skip_osx @pytest.mark.requirements -def test_skip_requirements_when_pipfile(PipenvInstance, pypi): +def test_skip_requirements_when_pipfile(PipenvInstance): """Ensure requirements.txt is NOT imported when 1. We do `pipenv install [package]` 2. A Pipfile already exists when we run `pipenv install`. """ - with PipenvInstance(chdir=True, pypi=pypi) as p: + with PipenvInstance(chdir=True) as p: with open("requirements.txt", "w") as f: f.write("requests==2.18.1\n") c = p.pipenv("install six") @@ -315,13 +315,13 @@ def test_skip_requirements_when_pipfile(PipenvInstance, pypi): contents = """ [packages] six = "*" -tablib = "<0.12" +"fake_package" = "<0.12" """.strip() f.write(contents) c = p.pipenv("install") assert c.ok - assert "tablib" in p.pipfile["packages"] - assert "tablib" in p.lockfile["default"] + assert "fake_package" in p.pipfile["packages"] + assert "fake_package" in p.lockfile["default"] assert "six" in p.pipfile["packages"] assert "six" in p.lockfile["default"] assert "requests" not in p.pipfile["packages"] @@ -330,24 +330,25 @@ def test_skip_requirements_when_pipfile(PipenvInstance, pypi): @pytest.mark.cli @pytest.mark.clean -def test_clean_on_empty_venv(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_clean_on_empty_venv(PipenvInstance): + with PipenvInstance() as p: c = p.pipenv("clean") assert c.return_code == 0 @pytest.mark.install -def test_install_does_not_extrapolate_environ(PipenvInstance, pypi): +def test_install_does_not_extrapolate_environ(PipenvInstance): """Ensure environment variables are not expanded in lock file. """ - with temp_environ(), PipenvInstance(pypi=pypi, chdir=True) as p: - os.environ["PYPI_URL"] = pypi.url + with temp_environ(), PipenvInstance(chdir=True) as p: + # os.environ["PYPI_URL"] = pypi.url + os.environ["PYPI_URL"] = p.pypi with open(p.pipfile_path, "w") as f: f.write( """ [[source]] -url = '${PYPI_URL}/simple' +url = '${PYPI_URL}/${PIPENV_PYPI_INDEX}/+simple' verify_ssl = true name = 'mockpi' """ @@ -356,14 +357,14 @@ def test_install_does_not_extrapolate_environ(PipenvInstance, pypi): # Ensure simple install does not extrapolate. c = p.pipenv("install") assert c.return_code == 0 - assert p.pipfile["source"][0]["url"] == "${PYPI_URL}/simple" - assert p.lockfile["_meta"]["sources"][0]["url"] == "${PYPI_URL}/simple" + assert p.pipfile["source"][0]["url"] == "${PYPI_URL}/${PIPENV_PYPI_INDEX}/+simple" + assert p.lockfile["_meta"]["sources"][0]["url"] == "${PYPI_URL}/${PIPENV_PYPI_INDEX}/+simple" # Ensure package install does not extrapolate. c = p.pipenv("install six") assert c.return_code == 0 - assert p.pipfile["source"][0]["url"] == "${PYPI_URL}/simple" - assert p.lockfile["_meta"]["sources"][0]["url"] == "${PYPI_URL}/simple" + assert p.pipfile["source"][0]["url"] == "${PYPI_URL}/${PIPENV_PYPI_INDEX}/+simple" + assert p.lockfile["_meta"]["sources"][0]["url"] == "${PYPI_URL}/${PIPENV_PYPI_INDEX}/+simple" @pytest.mark.editable @@ -378,10 +379,10 @@ def test_editable_no_args(PipenvInstance): @pytest.mark.install @pytest.mark.virtualenv -def test_install_venv_project_directory(PipenvInstance, pypi): +def test_install_venv_project_directory(PipenvInstance): """Test the project functionality during virtualenv creation. """ - with PipenvInstance(pypi=pypi, chdir=True) as p: + with PipenvInstance(chdir=True) as p: with temp_environ(), TemporaryDirectory( prefix="pipenv-", suffix="temp_workon_home" ) as workon_home: @@ -402,8 +403,8 @@ def test_install_venv_project_directory(PipenvInstance, pypi): @pytest.mark.deploy @pytest.mark.system -def test_system_and_deploy_work(PipenvInstance, pypi): - with PipenvInstance(chdir=True, pypi=pypi) as p: +def test_system_and_deploy_work(PipenvInstance): + with PipenvInstance(chdir=True) as p: c = p.pipenv("install six requests") assert c.return_code == 0 c = p.pipenv("--rm") @@ -438,24 +439,24 @@ def test_install_creates_pipfile(PipenvInstance): @pytest.mark.install -def test_install_non_exist_dep(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_install_non_exist_dep(PipenvInstance): + with PipenvInstance(chdir=True) as p: c = p.pipenv("install dateutil") assert not c.ok assert "dateutil" not in p.pipfile["packages"] @pytest.mark.install -def test_install_package_with_dots(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_install_package_with_dots(PipenvInstance): + with PipenvInstance(chdir=True) as p: c = p.pipenv("install backports.html") assert c.ok assert "backports.html" in p.pipfile["packages"] @pytest.mark.install -def test_rewrite_outline_table(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_rewrite_outline_table(PipenvInstance): + with PipenvInstance(chdir=True) as p: with open(p.pipfile_path, 'w') as f: contents = """ [packages] diff --git a/tests/integration/test_install_markers.py b/tests/integration/test_install_markers.py index 87770ed778..379731a417 100644 --- a/tests/integration/test_install_markers.py +++ b/tests/integration/test_install_markers.py @@ -12,33 +12,34 @@ from pipenv.utils import temp_environ -@pytest.mark.markers @flaky -def test_package_environment_markers(PipenvInstance, pypi): +@pytest.mark.markers +def test_package_environment_markers(PipenvInstance): - with PipenvInstance(pypi=pypi) as p: + with PipenvInstance() as p: with open(p.pipfile_path, 'w') as f: contents = """ [packages] -tablib = {version = "*", markers="os_name=='splashwear'"} +fake_package = {version = "*", markers="os_name=='splashwear'"} """.strip() f.write(contents) c = p.pipenv('install') assert c.return_code == 0 assert 'Ignoring' in c.out - assert 'markers' in p.lockfile['default']['tablib'], p.lockfile["default"]["tablib"] + assert 'markers' in p.lockfile['default']['fake_package'], p.lockfile["default"]["fake_package"] - c = p.pipenv('run python -c "import tablib;"') + c = p.pipenv('run python -c "import fake_package;"') assert c.return_code == 1 -@pytest.mark.markers + @flaky -def test_platform_python_implementation_marker(PipenvInstance, pypi): +@pytest.mark.markers +def test_platform_python_implementation_marker(PipenvInstance): """Markers should be converted during locking to help users who input this incorrectly. """ - with PipenvInstance(pypi=pypi) as p: + with PipenvInstance() as p: with open(p.pipfile_path, 'w') as f: contents = """ [packages] @@ -57,17 +58,17 @@ def test_platform_python_implementation_marker(PipenvInstance, pypi): "platform_python_implementation == 'CPython'" +@flaky @pytest.mark.run @pytest.mark.alt @pytest.mark.install -@flaky -def test_specific_package_environment_markers(PipenvInstance, pypi): +def test_specific_package_environment_markers(PipenvInstance): - with PipenvInstance(pypi=pypi) as p: + with PipenvInstance() as p: with open(p.pipfile_path, 'w') as f: contents = """ [packages] -tablib = {version = "*", os_name = "== 'splashwear'"} +fake_package = {version = "*", os_name = "== 'splashwear'"} """.strip() f.write(contents) @@ -75,18 +76,18 @@ def test_specific_package_environment_markers(PipenvInstance, pypi): assert c.return_code == 0 assert 'Ignoring' in c.out - assert 'markers' in p.lockfile['default']['tablib'] + assert 'markers' in p.lockfile['default']['fake_package'] - c = p.pipenv('run python -c "import tablib;"') + c = p.pipenv('run python -c "import fake_package;"') assert c.return_code == 1 -@pytest.mark.markers @flaky -def test_top_level_overrides_environment_markers(PipenvInstance, pypi): +@pytest.mark.markers +def test_top_level_overrides_environment_markers(PipenvInstance): """Top-level environment markers should take precedence. """ - with PipenvInstance(pypi=pypi) as p: + with PipenvInstance() as p: with open(p.pipfile_path, 'w') as f: contents = """ [packages] @@ -101,17 +102,17 @@ def test_top_level_overrides_environment_markers(PipenvInstance, pypi): assert p.lockfile['default']['funcsigs']['markers'] == "os_name == 'splashwear'", p.lockfile['default']['funcsigs'] +@flaky @pytest.mark.markers @pytest.mark.install -@flaky -def test_global_overrides_environment_markers(PipenvInstance, pypi): +def test_global_overrides_environment_markers(PipenvInstance): """Empty (unconditional) dependency should take precedence. If a dependency is specified without environment markers, it should override dependencies with environment markers. In this example, APScheduler requires funcsigs only on Python 2, but since funcsigs is also specified as an unconditional dep, its markers should be empty. """ - with PipenvInstance(pypi=pypi) as p: + with PipenvInstance() as p: with open(p.pipfile_path, 'w') as f: contents = """ [packages] @@ -126,12 +127,12 @@ def test_global_overrides_environment_markers(PipenvInstance, pypi): assert p.lockfile['default']['funcsigs'].get('markers', '') == '' +@flaky @pytest.mark.lock @pytest.mark.complex @pytest.mark.py3_only @pytest.mark.lte_py36 -@flaky -def test_resolver_unique_markers(PipenvInstance, pypi): +def test_resolver_unique_markers(PipenvInstance): """vcrpy has a dependency on `yarl` which comes with a marker of 'python version in "3.4, 3.5, 3.6" - this marker duplicates itself: @@ -139,7 +140,7 @@ def test_resolver_unique_markers(PipenvInstance, pypi): This verifies that we clean that successfully. """ - with PipenvInstance(chdir=True, pypi=pypi) as p: + with PipenvInstance(chdir=True) as p: c = p.pipenv('install vcrpy==2.0.1') assert c.return_code == 0 c = p.pipenv('lock') @@ -151,10 +152,10 @@ def test_resolver_unique_markers(PipenvInstance, pypi): assert yarl['markers'] in ["python_version in '3.4, 3.5, 3.6'", "python_version >= '3.4'"] -@pytest.mark.project @flaky -def test_environment_variable_value_does_not_change_hash(PipenvInstance, pypi): - with PipenvInstance(chdir=True, pypi=pypi) as p: +@pytest.mark.project +def test_environment_variable_value_does_not_change_hash(PipenvInstance): + with PipenvInstance(chdir=True) as p: with temp_environ(): with open(p.pipfile_path, 'w') as f: f.write(""" diff --git a/tests/integration/test_install_twists.py b/tests/integration/test_install_twists.py index a231c17d5c..44973df5a3 100644 --- a/tests/integration/test_install_twists.py +++ b/tests/integration/test_install_twists.py @@ -17,10 +17,10 @@ @pytest.mark.extras @pytest.mark.install @pytest.mark.local -def test_local_extras_install(PipenvInstance, pypi): +def test_local_extras_install(PipenvInstance): """Ensure -e .[extras] installs. """ - with PipenvInstance(pypi=pypi, chdir=True) as p: + with PipenvInstance(chdir=True) as p: setup_py = os.path.join(p.path, "setup.py") with open(setup_py, "w") as fh: contents = """ @@ -102,10 +102,10 @@ def helper_dependency_links_install_test(pipenv_instance, deplink): assert "version" in pipenv_instance.lockfile["default"]["test-private-dependency"] assert "0.1" in pipenv_instance.lockfile["default"]["test-private-dependency"]["version"] - def test_https_dependency_links_install(self, PipenvInstance, pypi): + def test_https_dependency_links_install(self, PipenvInstance): """Ensure dependency_links are parsed and installed (needed for private repo dependencies). """ - with temp_environ(), PipenvInstance(pypi=pypi, chdir=True) as p: + with temp_environ(), PipenvInstance(chdir=True) as p: os.environ["PIP_NO_BUILD_ISOLATION"] = '1' TestDirectDependencies.helper_dependency_links_install_test( p, @@ -113,8 +113,8 @@ def test_https_dependency_links_install(self, PipenvInstance, pypi): ) @pytest.mark.needs_github_ssh - def test_ssh_dependency_links_install(self, PipenvInstance, pypi): - with temp_environ(), PipenvInstance(pypi=pypi, chdir=True) as p: + def test_ssh_dependency_links_install(self, PipenvInstance): + with temp_environ(), PipenvInstance(chdir=True) as p: os.environ['PIP_PROCESS_DEPENDENCY_LINKS'] = '1' os.environ["PIP_NO_BUILD_ISOLATION"] = '1' TestDirectDependencies.helper_dependency_links_install_test( @@ -140,11 +140,11 @@ def test_e_dot(PipenvInstance, pip_src_dir): @pytest.mark.install @flaky -def test_multiprocess_bug_and_install(PipenvInstance, pypi): +def test_multiprocess_bug_and_install(PipenvInstance): with temp_environ(): os.environ["PIPENV_MAX_SUBPROCESS"] = "2" - with PipenvInstance(pypi=pypi, chdir=True) as p: + with PipenvInstance(chdir=True) as p: with open(p.pipfile_path, "w") as f: contents = """ [packages] @@ -168,9 +168,9 @@ def test_multiprocess_bug_and_install(PipenvInstance, pypi): @pytest.mark.sequential @pytest.mark.install @flaky -def test_sequential_mode(PipenvInstance, pypi): +def test_sequential_mode(PipenvInstance): - with PipenvInstance(pypi=pypi, chdir=True) as p: + with PipenvInstance(chdir=True) as p: with open(p.pipfile_path, "w") as f: contents = """ [packages] @@ -193,8 +193,8 @@ def test_sequential_mode(PipenvInstance, pypi): @pytest.mark.install @pytest.mark.run -def test_normalize_name_install(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_normalize_name_install(PipenvInstance): + with PipenvInstance() as p: with open(p.pipfile_path, "w") as f: contents = """ # Pre comment @@ -222,18 +222,18 @@ def test_normalize_name_install(PipenvInstance, pypi): assert "# Inline comment" in contents +@flaky @pytest.mark.files @pytest.mark.resolver @pytest.mark.eggs -@flaky -def test_local_package(PipenvInstance, pip_src_dir, pypi, testsroot): +def test_local_package(PipenvInstance, pip_src_dir, testsroot): """This test ensures that local packages (directories with a setup.py) installed in editable mode have their dependencies resolved as well""" file_name = "requests-2.19.1.tar.gz" package = "requests-2.19.1" # Not sure where travis/appveyor run tests from source_path = os.path.abspath(os.path.join(testsroot, "test_artifacts", file_name)) - with PipenvInstance(chdir=True, pypi=pypi) as p: + with PipenvInstance(chdir=True) as p: # This tests for a bug when installing a zipfile in the current dir copy_to = os.path.join(p.path, file_name) shutil.copy(source_path, copy_to) @@ -251,12 +251,12 @@ def test_local_package(PipenvInstance, pip_src_dir, pypi, testsroot): @pytest.mark.files @flaky -def test_local_zipfiles(PipenvInstance, pypi, testsroot): +def test_local_zipfiles(PipenvInstance, testsroot): file_name = "requests-2.19.1.tar.gz" # Not sure where travis/appveyor run tests from source_path = os.path.abspath(os.path.join(testsroot, "test_artifacts", file_name)) - with PipenvInstance(chdir=True, pypi=pypi) as p: + with PipenvInstance(chdir=True) as p: # This tests for a bug when installing a zipfile in the current dir shutil.copy(source_path, os.path.join(p.path, file_name)) @@ -276,11 +276,11 @@ def test_local_zipfiles(PipenvInstance, pypi, testsroot): @pytest.mark.files @flaky -def test_relative_paths(PipenvInstance, pypi, testsroot): +def test_relative_paths(PipenvInstance, testsroot): file_name = "requests-2.19.1.tar.gz" source_path = os.path.abspath(os.path.join(testsroot, "test_artifacts", file_name)) - with PipenvInstance(pypi=pypi) as p: + with PipenvInstance() as p: artifact_dir = "artifacts" artifact_path = os.path.join(p.path, artifact_dir) mkdir_p(artifact_path) @@ -299,8 +299,8 @@ def test_relative_paths(PipenvInstance, pypi, testsroot): @pytest.mark.install @pytest.mark.local_file @flaky -def test_install_local_file_collision(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_install_local_file_collision(PipenvInstance): + with PipenvInstance() as p: target_package = "alembic" fake_file = os.path.join(p.path, target_package) with open(fake_file, "w") as f: @@ -339,7 +339,7 @@ def test_install_local_uri_special_character(PipenvInstance, testsroot): @pytest.mark.files @pytest.mark.install @pytest.mark.run -def test_multiple_editable_packages_should_not_race(PipenvInstance, pypi, testsroot): +def test_multiple_editable_packages_should_not_race(PipenvInstance, testsroot): """Test for a race condition that can occur when installing multiple 'editable' packages at once, and which causes some of them to not be importable. @@ -356,7 +356,7 @@ def test_multiple_editable_packages_should_not_race(PipenvInstance, pypi, testsr [packages] """ - with PipenvInstance(pypi=pypi, chdir=True) as p: + with PipenvInstance(chdir=True) as p: for pkg_name in pkgs: source_path = p._pipfile.get_fixture_path("git/{0}/".format(pkg_name)).as_posix() c = delegator.run("git clone {0} ./{1}".format(source_path, pkg_name)) diff --git a/tests/integration/test_install_uri.py b/tests/integration/test_install_uri.py index 3edc1e1154..58df07bd02 100644 --- a/tests/integration/test_install_uri.py +++ b/tests/integration/test_install_uri.py @@ -13,8 +13,8 @@ @pytest.mark.vcs @pytest.mark.install @pytest.mark.needs_internet -def test_basic_vcs_install(PipenvInstance, pip_src_dir, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_basic_vcs_install(PipenvInstance): # ! This is failing + with PipenvInstance(chdir=True) as p: c = p.pipenv("install git+https://github.com/benjaminp/six.git@1.11.0#egg=six") assert c.return_code == 0 # edge case where normal package starts with VCS name shouldn't be flagged as vcs @@ -34,8 +34,8 @@ def test_basic_vcs_install(PipenvInstance, pip_src_dir, pypi): @pytest.mark.vcs @pytest.mark.install @pytest.mark.needs_internet -def test_git_vcs_install(PipenvInstance, pip_src_dir, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_git_vcs_install(PipenvInstance): + with PipenvInstance(chdir=True) as p: c = p.pipenv("install git+git://github.com/benjaminp/six.git@1.11.0#egg=six") assert c.return_code == 0 assert "six" in p.pipfile["packages"] @@ -52,8 +52,8 @@ def test_git_vcs_install(PipenvInstance, pip_src_dir, pypi): @pytest.mark.install @pytest.mark.needs_internet @pytest.mark.needs_github_ssh -def test_ssh_vcs_install(PipenvInstance, pip_src_dir, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_ssh_vcs_install(PipenvInstance): + with PipenvInstance(chdir=True) as p: c = p.pipenv("install git+ssh://git@github.com/benjaminp/six.git@1.11.0#egg=six") assert c.return_code == 0 assert "six" in p.pipfile["packages"] @@ -69,8 +69,8 @@ def test_ssh_vcs_install(PipenvInstance, pip_src_dir, pypi): @pytest.mark.urls @pytest.mark.files @pytest.mark.needs_internet -def test_urls_work(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_urls_work(PipenvInstance): + with PipenvInstance(chdir=True) as p: # the library this installs is "django-cms" path = p._pipfile.get_url("django", "3.4.x.zip") c = p.pipenv( @@ -107,10 +107,10 @@ def test_file_urls_work(PipenvInstance, pip_src_dir): @pytest.mark.urls @pytest.mark.files @pytest.mark.needs_internet -def test_local_vcs_urls_work(PipenvInstance, pypi, tmpdir): +def test_local_vcs_urls_work(PipenvInstance, tmpdir): six_dir = tmpdir.join("six") six_path = Path(six_dir.strpath) - with PipenvInstance(pypi=pypi, chdir=True) as p: + with PipenvInstance(chdir=True) as p: c = delegator.run( "git clone https://github.com/benjaminp/six.git {0}".format(six_dir.strpath) ) @@ -125,10 +125,10 @@ def test_local_vcs_urls_work(PipenvInstance, pypi, tmpdir): @pytest.mark.vcs @pytest.mark.install @pytest.mark.needs_internet -def test_editable_vcs_install(PipenvInstance, pip_src_dir, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_editable_vcs_install(PipenvInstance_NoPyPI): # ! This is failing + with PipenvInstance_NoPyPI(chdir=True) as p: c = p.pipenv( - "install -e git+https://github.com/requests/requests.git#egg=requests" + "install -e git+https://github.com/kennethreitz/requests.git#egg=requests --verbose" ) assert c.return_code == 0 assert "requests" in p.pipfile["packages"] @@ -145,12 +145,12 @@ def test_editable_vcs_install(PipenvInstance, pip_src_dir, pypi): @pytest.mark.tablib @pytest.mark.install @pytest.mark.needs_internet -def test_install_editable_git_tag(PipenvInstance, pypi): +def test_install_editable_git_tag(PipenvInstance_NoPyPI): # ! This is failing # This uses the real PyPI since we need Internet to access the Git # dependency anyway. - with PipenvInstance(pypi=pypi) as p: + with PipenvInstance_NoPyPI(chdir=True) as p: c = p.pipenv( - "install -e git+https://github.com/benjaminp/six.git@1.11.0#egg=six" + "install -e git+https://github.com/benjaminp/six.git@1.11.0#egg=six --verbose" ) assert c.return_code == 0 assert "six" in p.pipfile["packages"] @@ -193,7 +193,7 @@ def test_install_named_index_alias(PipenvInstance): @pytest.mark.vcs @pytest.mark.install @pytest.mark.needs_internet -def test_install_local_vcs_not_in_lockfile(PipenvInstance, pip_src_dir): +def test_install_local_vcs_not_in_lockfile(PipenvInstance): with PipenvInstance(chdir=True) as p: # six_path = os.path.join(p.path, "six") six_path = p._pipfile.get_fixture_path("git/six/").as_posix() @@ -209,10 +209,10 @@ def test_install_local_vcs_not_in_lockfile(PipenvInstance, pip_src_dir): @pytest.mark.vcs @pytest.mark.install @pytest.mark.needs_internet -def test_get_vcs_refs(PipenvInstance): - with PipenvInstance(chdir=True) as p: +def test_get_vcs_refs(PipenvInstance_NoPyPI): # ! this is failing + with PipenvInstance_NoPyPI(chdir=True) as p: c = p.pipenv( - "install -e git+https://github.com/benjaminp/six.git@1.9.0#egg=six" + "install -e git+https://github.com/benjaminp/six.git@1.9.0#egg=six --verbose" ) assert c.return_code == 0 assert "six" in p.pipfile["packages"] @@ -238,7 +238,7 @@ def test_get_vcs_refs(PipenvInstance): @pytest.mark.install @pytest.mark.needs_internet @pytest.mark.skip_py27_win -def test_vcs_entry_supersedes_non_vcs(PipenvInstance, pip_src_dir): +def test_vcs_entry_supersedes_non_vcs(PipenvInstance): """See issue #2181 -- non-editable VCS dep was specified, but not showing up in the lockfile -- due to not running pip install before locking and not locking the resolution graph of non-editable vcs dependencies. @@ -275,8 +275,8 @@ def test_vcs_entry_supersedes_non_vcs(PipenvInstance, pip_src_dir): @pytest.mark.vcs @pytest.mark.install @pytest.mark.needs_internet -def test_vcs_can_use_markers(PipenvInstance, pip_src_dir, pypi): - with PipenvInstance(chdir=True, pypi=pypi) as p: +def test_vcs_can_use_markers(PipenvInstance): + with PipenvInstance(chdir=True) as p: path = p._pipfile.get_fixture_path("git/six/.git") p._pipfile.install("six", {"git": "{0}".format(path.as_uri()), "markers": "sys_platform == 'linux'"}) assert "six" in p.pipfile["packages"] diff --git a/tests/integration/test_lock.py b/tests/integration/test_lock.py index f9b208263e..44f68bfe05 100644 --- a/tests/integration/test_lock.py +++ b/tests/integration/test_lock.py @@ -14,7 +14,7 @@ @pytest.mark.lock @pytest.mark.requirements -def test_lock_handle_eggs(PipenvInstance, pypi): +def test_lock_handle_eggs(PipenvInstance): """Ensure locking works with packages provoding egg formats. """ with PipenvInstance() as p: @@ -31,9 +31,9 @@ def test_lock_handle_eggs(PipenvInstance, pypi): @pytest.mark.lock @pytest.mark.requirements -def test_lock_requirements_file(PipenvInstance, pypi): +def test_lock_requirements_file(PipenvInstance): - with PipenvInstance(pypi=pypi) as p: + with PipenvInstance() as p: with open(p.pipfile_path, 'w') as f: contents = """ [packages] @@ -61,9 +61,9 @@ def test_lock_requirements_file(PipenvInstance, pypi): @pytest.mark.lock @pytest.mark.keep_outdated -def test_lock_keep_outdated(PipenvInstance, pypi): +def test_lock_keep_outdated(PipenvInstance): - with PipenvInstance(pypi=pypi) as p: + with PipenvInstance() as p: with open(p.pipfile_path, 'w') as f: contents = """ [packages] @@ -99,8 +99,8 @@ def test_lock_keep_outdated(PipenvInstance, pypi): @pytest.mark.lock @pytest.mark.keep_outdated -def test_keep_outdated_doesnt_remove_lockfile_entries(PipenvInstance, pypi): - with PipenvInstance(chdir=True, pypi=pypi) as p: +def test_keep_outdated_doesnt_remove_lockfile_entries(PipenvInstance): + with PipenvInstance(chdir=True) as p: p._pipfile.add("requests", "==2.18.4") p._pipfile.add("colorama", {"version": "*", "markers": "os_name=='FakeOS'"}) p.pipenv("install") @@ -112,8 +112,8 @@ def test_keep_outdated_doesnt_remove_lockfile_entries(PipenvInstance, pypi): @pytest.mark.lock @pytest.mark.keep_outdated -def test_keep_outdated_doesnt_upgrade_pipfile_pins(PipenvInstance, pypi): - with PipenvInstance(chdir=True, pypi=pypi) as p: +def test_keep_outdated_doesnt_upgrade_pipfile_pins(PipenvInstance): + with PipenvInstance(chdir=True) as p: p._pipfile.add("urllib3", "==1.21.1") c = p.pipenv("install") assert c.ok @@ -126,8 +126,8 @@ def test_keep_outdated_doesnt_upgrade_pipfile_pins(PipenvInstance, pypi): assert p.lockfile["default"]["urllib3"]["version"] == "==1.21.1" -def test_keep_outdated_keeps_markers_not_removed(PipenvInstance, pypi): - with PipenvInstance(chdir=True, pypi=pypi) as p: +def test_keep_outdated_keeps_markers_not_removed(PipenvInstance): + with PipenvInstance(chdir=True) as p: c = p.pipenv("install six click") assert c.ok lockfile = Path(p.lockfile_path) @@ -143,8 +143,8 @@ def test_keep_outdated_keeps_markers_not_removed(PipenvInstance, pypi): @pytest.mark.lock @pytest.mark.keep_outdated -def test_keep_outdated_doesnt_update_satisfied_constraints(PipenvInstance, pypi): - with PipenvInstance(chdir=True, pypi=pypi) as p: +def test_keep_outdated_doesnt_update_satisfied_constraints(PipenvInstance): + with PipenvInstance(chdir=True) as p: p._pipfile.add("requests", "==2.18.4") c = p.pipenv("install") assert c.ok @@ -174,7 +174,7 @@ def test_complex_lock_with_vcs_deps(PipenvInstance, pip_src_dir): click = "==6.7" [dev-packages] -requests = {git = "https://github.com/requests/requests.git"} +requests = {git = "https://github.com/kennethreitz/requests.git"} """.strip() f.write(contents) @@ -198,9 +198,9 @@ def test_complex_lock_with_vcs_deps(PipenvInstance, pip_src_dir): @pytest.mark.lock @pytest.mark.requirements -def test_lock_with_prereleases(PipenvInstance, pypi): +def test_lock_with_prereleases(PipenvInstance): - with PipenvInstance(pypi=pypi) as p: + with PipenvInstance() as p: with open(p.pipfile_path, 'w') as f: contents = """ [packages] @@ -221,9 +221,9 @@ def test_lock_with_prereleases(PipenvInstance, pypi): @pytest.mark.complex @pytest.mark.needs_internet @flaky -def test_complex_deps_lock_and_install_properly(PipenvInstance, pip_src_dir, pypi): +def test_complex_deps_lock_and_install_properly(PipenvInstance, pip_src_dir): # This uses the real PyPI because Maya has too many dependencies... - with PipenvInstance(chdir=True, pypi=pypi) as p: + with PipenvInstance(chdir=True) as p: with open(p.pipfile_path, 'w') as f: contents = """ [packages] @@ -240,8 +240,8 @@ def test_complex_deps_lock_and_install_properly(PipenvInstance, pip_src_dir, pyp @pytest.mark.lock @pytest.mark.extras -def test_lock_extras_without_install(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_lock_extras_without_install(PipenvInstance): + with PipenvInstance() as p: with open(p.pipfile_path, 'w') as f: contents = """ [packages] @@ -265,11 +265,11 @@ def test_lock_extras_without_install(PipenvInstance, pypi): @pytest.mark.complex @pytest.mark.needs_internet @pytest.mark.skip(reason='Needs numpy to be mocked') -def test_complex_lock_deep_extras(PipenvInstance, pypi): +def test_complex_lock_deep_extras(PipenvInstance): # records[pandas] requires tablib[pandas] which requires pandas. # This uses the real PyPI; Pandas has too many requirements to mock. - with PipenvInstance(pypi=pypi) as p: + with PipenvInstance() as p: with open(p.pipfile_path, 'w') as f: contents = """ [packages] @@ -387,21 +387,22 @@ def test_private_index_mirror_lock_requirements(PipenvInstance): @pytest.mark.index @pytest.mark.install -def test_lock_updated_source(PipenvInstance, pypi): +def test_lock_updated_source(PipenvInstance): - with PipenvInstance(pypi=pypi) as p: + with PipenvInstance() as p: with open(p.pipfile_path, 'w') as f: contents = """ [[source]] -url = "{url}/${{MY_ENV_VAR}}" +url = "{url}/${{MY_ENV_VAR}}/+simple" [packages] requests = "==2.14.0" - """.strip().format(url=pypi.url) + """.strip().format(url=p.pypi) + # """.strip().format(url=pypi.url) f.write(contents) with temp_environ(): - os.environ['MY_ENV_VAR'] = 'simple' + os.environ['MY_ENV_VAR'] = p.index c = p.pipenv('lock') assert c.return_code == 0 assert 'requests' in p.lockfile['default'] @@ -409,11 +410,12 @@ def test_lock_updated_source(PipenvInstance, pypi): with open(p.pipfile_path, 'w') as f: contents = """ [[source]] -url = "{url}/simple" +url = "{url}" [packages] requests = "==2.14.0" - """.strip().format(url=pypi.url) + """.strip().format(url=p.index_url) + # """.strip().format(url=pypi.url) f.write(contents) c = p.pipenv('lock') @@ -424,12 +426,12 @@ def test_lock_updated_source(PipenvInstance, pypi): @pytest.mark.vcs @pytest.mark.lock @pytest.mark.needs_internet -def test_lock_editable_vcs_without_install(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_lock_editable_vcs_without_install(PipenvInstance): + with PipenvInstance(chdir=True) as p: with open(p.pipfile_path, 'w') as f: f.write(""" [packages] -requests = {git = "https://github.com/requests/requests.git", ref = "master", editable = true} +requests = {git = "https://github.com/kennethreitz/requests.git", ref = "master", editable = true} """.strip()) c = p.pipenv('lock') assert c.return_code == 0 @@ -443,16 +445,16 @@ def test_lock_editable_vcs_without_install(PipenvInstance, pypi): @pytest.mark.vcs @pytest.mark.lock @pytest.mark.needs_internet -def test_lock_editable_vcs_with_ref_in_git(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_lock_editable_vcs_with_ref_in_git(PipenvInstance): + with PipenvInstance(chdir=True) as p: with open(p.pipfile_path, 'w') as f: f.write(""" [packages] -requests = {git = "https://github.com/requests/requests.git@883caaf", editable = true} +requests = {git = "https://github.com/kennethreitz/requests.git@883caaf", editable = true} """.strip()) c = p.pipenv('lock') assert c.return_code == 0 - assert p.lockfile['default']['requests']['git'] == 'https://github.com/requests/requests.git' + assert p.lockfile['default']['requests']['git'] == 'https://github.com/kennethreitz/requests.git' assert p.lockfile['default']['requests']['ref'] == '883caaf145fbe93bd0d208a6b864de9146087312' c = p.pipenv('install') assert c.return_code == 0 @@ -461,16 +463,16 @@ def test_lock_editable_vcs_with_ref_in_git(PipenvInstance, pypi): @pytest.mark.vcs @pytest.mark.lock @pytest.mark.needs_internet -def test_lock_editable_vcs_with_ref(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_lock_editable_vcs_with_ref(PipenvInstance): + with PipenvInstance(chdir=True) as p: with open(p.pipfile_path, 'w') as f: f.write(""" [packages] -requests = {git = "https://github.com/requests/requests.git", ref = "883caaf", editable = true} +requests = {git = "https://github.com/kennethreitz/requests.git", ref = "883caaf", editable = true} """.strip()) c = p.pipenv('lock') assert c.return_code == 0 - assert p.lockfile['default']['requests']['git'] == 'https://github.com/requests/requests.git' + assert p.lockfile['default']['requests']['git'] == 'https://github.com/kennethreitz/requests.git' assert p.lockfile['default']['requests']['ref'] == '883caaf145fbe93bd0d208a6b864de9146087312' c = p.pipenv('install') assert c.return_code == 0 @@ -480,12 +482,12 @@ def test_lock_editable_vcs_with_ref(PipenvInstance, pypi): @pytest.mark.lock @pytest.mark.extras @pytest.mark.needs_internet -def test_lock_editable_vcs_with_extras_without_install(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_lock_editable_vcs_with_extras_without_install(PipenvInstance): + with PipenvInstance(chdir=True) as p: with open(p.pipfile_path, 'w') as f: f.write(""" [packages] -requests = {git = "https://github.com/requests/requests.git", editable = true, extras = ["socks"]} +requests = {git = "https://github.com/kennethreitz/requests.git", editable = true, extras = ["socks"]} """.strip()) c = p.pipenv('lock') assert c.return_code == 0 @@ -500,12 +502,12 @@ def test_lock_editable_vcs_with_extras_without_install(PipenvInstance, pypi): @pytest.mark.vcs @pytest.mark.lock @pytest.mark.needs_internet -def test_lock_editable_vcs_with_markers_without_install(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_lock_editable_vcs_with_markers_without_install(PipenvInstance): + with PipenvInstance(chdir=True) as p: with open(p.pipfile_path, 'w') as f: f.write(""" [packages] -requests = {git = "https://github.com/requests/requests.git", ref = "master", editable = true, markers = "python_version >= '2.6'"} +requests = {git = "https://github.com/kennethreitz/requests.git", ref = "master", editable = true, markers = "python_version >= '2.6'"} """.strip()) c = p.pipenv('lock') assert c.return_code == 0 @@ -518,8 +520,8 @@ def test_lock_editable_vcs_with_markers_without_install(PipenvInstance, pypi): @pytest.mark.lock @pytest.mark.skip(reason="This doesn't work for some reason.") -def test_lock_respecting_python_version(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_lock_respecting_python_version(PipenvInstance): + with PipenvInstance(chdir=True) as p: with open(p.pipfile_path, 'w') as f: f.write(""" [packages] @@ -562,8 +564,8 @@ def test_lockfile_with_empty_dict(PipenvInstance): @pytest.mark.lock @pytest.mark.install @pytest.mark.skip_lock -def test_lock_with_incomplete_source(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_lock_with_incomplete_source(PipenvInstance): + with PipenvInstance(chdir=True) as p: with open(p.pipfile_path, 'w') as f: f.write(""" [[source]] @@ -581,8 +583,8 @@ def test_lock_with_incomplete_source(PipenvInstance, pypi): @pytest.mark.lock @pytest.mark.install -def test_lock_no_warnings(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_lock_no_warnings(PipenvInstance): + with PipenvInstance(chdir=True) as p: os.environ["PYTHONWARNINGS"] = str("once") c = p.pipenv("install six") assert c.return_code == 0 @@ -596,7 +598,7 @@ def test_lock_no_warnings(PipenvInstance, pypi): @pytest.mark.lock @pytest.mark.install @pytest.mark.skipif(sys.version_info >= (3, 5), reason="scandir doesn't get installed on python 3.5+") -def test_lock_missing_cache_entries_gets_all_hashes(PipenvInstance, pypi, tmpdir): +def test_lock_missing_cache_entries_gets_all_hashes(PipenvInstance, tmpdir): """ Test locking pathlib2 on python2.7 which needs `scandir`, but fails to resolve when using a fresh dependency cache. @@ -604,7 +606,7 @@ def test_lock_missing_cache_entries_gets_all_hashes(PipenvInstance, pypi, tmpdir with temp_environ(): os.environ["PIPENV_CACHE_DIR"] = str(tmpdir.strpath) - with PipenvInstance(pypi=pypi, chdir=True) as p: + with PipenvInstance(chdir=True) as p: p._pipfile.add("pathlib2", "*") assert "pathlib2" in p.pipfile["packages"] c = p.pipenv("install") @@ -619,10 +621,10 @@ def test_lock_missing_cache_entries_gets_all_hashes(PipenvInstance, pypi, tmpdir @pytest.mark.vcs @pytest.mark.lock -def test_vcs_lock_respects_top_level_pins(PipenvInstance, pypi): +def test_vcs_lock_respects_top_level_pins(PipenvInstance): """Test that locking VCS dependencies respects top level packages pinned in Pipfiles""" - with PipenvInstance(pypi=pypi, chdir=True) as p: + with PipenvInstance(chdir=True) as p: requests_uri = p._pipfile.get_fixture_path("git/requests").as_uri() p._pipfile.add("requests", { "editable": True, "git": "{0}".format(requests_uri), @@ -638,8 +640,8 @@ def test_vcs_lock_respects_top_level_pins(PipenvInstance, pypi): @pytest.mark.lock -def test_lock_after_update_source_name(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_lock_after_update_source_name(PipenvInstance): + with PipenvInstance(chdir=True) as p: contents = """ [[source]] url = "https://test.pypi.org/simple" diff --git a/tests/integration/test_pipenv.py b/tests/integration/test_pipenv.py index 23ebfc4c5f..b050a72eba 100644 --- a/tests/integration/test_pipenv.py +++ b/tests/integration/test_pipenv.py @@ -28,9 +28,9 @@ def test_code_import_manual(PipenvInstance): @pytest.mark.lock @pytest.mark.deploy @pytest.mark.cli -def test_deploy_works(PipenvInstance, pypi): +def test_deploy_works(PipenvInstance): - with PipenvInstance(pypi=pypi, chdir=True) as p: + with PipenvInstance(chdir=True) as p: with open(p.pipfile_path, 'w') as f: contents = """ [packages] @@ -61,9 +61,9 @@ def test_deploy_works(PipenvInstance, pypi): @pytest.mark.update @pytest.mark.lock -def test_update_locks(PipenvInstance, pypi): +def test_update_locks(PipenvInstance): - with PipenvInstance(pypi=pypi) as p: + with PipenvInstance() as p: c = p.pipenv('install requests==2.14.0') assert c.return_code == 0 with open(p.pipfile_path, 'r') as fh: @@ -82,8 +82,8 @@ def test_update_locks(PipenvInstance, pypi): @pytest.mark.project @pytest.mark.proper_names -def test_proper_names_unamanged_virtualenv(PipenvInstance, pypi): - with PipenvInstance(chdir=True, pypi=pypi): +def test_proper_names_unamanged_virtualenv(PipenvInstance): + with PipenvInstance(chdir=True): c = delegator.run('python -m virtualenv .venv') assert c.return_code == 0 project = Project() diff --git a/tests/integration/test_project.py b/tests/integration/test_project.py index 436f11c135..efdc03b698 100644 --- a/tests/integration/test_project.py +++ b/tests/integration/test_project.py @@ -39,8 +39,8 @@ def test_pipfile_envvar_expansion(PipenvInstance): @pytest.mark.project @pytest.mark.sources @pytest.mark.parametrize('lock_first', [True, False]) -def test_get_source(PipenvInstance, pypi, lock_first): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_get_source(PipenvInstance, lock_first): + with PipenvInstance(chdir=True) as p: with open(p.pipfile_path, 'w') as f: contents = """ [[source]] @@ -86,8 +86,8 @@ def test_get_source(PipenvInstance, pypi, lock_first): @pytest.mark.install @pytest.mark.project @pytest.mark.parametrize('newlines', [u'\n', u'\r\n']) -def test_maintain_file_line_endings(PipenvInstance, pypi, newlines): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_maintain_file_line_endings(PipenvInstance, newlines): + with PipenvInstance(chdir=True) as p: # Initial pipfile + lockfile generation c = p.pipenv('install pytz') assert c.return_code == 0 @@ -122,8 +122,8 @@ def test_maintain_file_line_endings(PipenvInstance, pypi, newlines): @pytest.mark.project @pytest.mark.sources -def test_many_indexes(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_many_indexes(PipenvInstance): + with PipenvInstance(chdir=True) as p: with open(p.pipfile_path, 'w') as f: contents = """ [[source]] @@ -154,11 +154,11 @@ def test_many_indexes(PipenvInstance, pypi): @pytest.mark.install @pytest.mark.project -def test_include_editable_packages(PipenvInstance, pypi, testsroot, pathlib_tmpdir): +def test_include_editable_packages(PipenvInstance, testsroot, pathlib_tmpdir): file_name = "requests-2.19.1.tar.gz" package = pathlib_tmpdir.joinpath("requests-2.19.1") source_path = os.path.abspath(os.path.join(testsroot, "test_artifacts", file_name)) - with PipenvInstance(chdir=True, pypi=pypi) as p: + with PipenvInstance(chdir=True) as p: with tarfile.open(source_path, "r:gz") as tarinfo: tarinfo.extractall(path=str(pathlib_tmpdir)) c = p.pipenv('install -e {}'.format(package)) @@ -172,8 +172,8 @@ def test_include_editable_packages(PipenvInstance, pypi, testsroot, pathlib_tmpd @pytest.mark.project @pytest.mark.virtualenv -def test_run_in_virtualenv_with_global_context(PipenvInstance, pypi, virtualenv): - with PipenvInstance(chdir=True, pypi=pypi, venv_root=virtualenv.as_posix(), ignore_virtualenvs=False, venv_in_project=False) as p: +def test_run_in_virtualenv_with_global_context(PipenvInstance, virtualenv): + with PipenvInstance(chdir=True, venv_root=virtualenv.as_posix(), ignore_virtualenvs=False, venv_in_project=False) as p: c = delegator_run( "pipenv run pip freeze", cwd=os.path.abspath(p.path), env=os.environ.copy() @@ -210,8 +210,8 @@ def test_run_in_virtualenv_with_global_context(PipenvInstance, pypi, virtualenv) @pytest.mark.project @pytest.mark.virtualenv -def test_run_in_virtualenv(PipenvInstance, pypi): - with PipenvInstance(chdir=True, pypi=pypi) as p: +def test_run_in_virtualenv(PipenvInstance): + with PipenvInstance(chdir=True) as p: c = p.pipenv('run pip freeze') assert c.return_code == 0 assert 'Creating a virtualenv' in c.err diff --git a/tests/integration/test_sync.py b/tests/integration/test_sync.py index 1300bf5dec..d085aaf421 100644 --- a/tests/integration/test_sync.py +++ b/tests/integration/test_sync.py @@ -9,8 +9,8 @@ @pytest.mark.sync -def test_sync_error_without_lockfile(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_sync_error_without_lockfile(PipenvInstance): + with PipenvInstance(chdir=True) as p: with open(p.pipfile_path, 'w') as f: f.write(""" [packages] @@ -23,8 +23,8 @@ def test_sync_error_without_lockfile(PipenvInstance, pypi): @pytest.mark.sync @pytest.mark.lock -def test_mirror_lock_sync(PipenvInstance, pypi): - with temp_environ(), PipenvInstance(chdir=True, pypi=pypi) as p: +def test_mirror_lock_sync(PipenvInstance): + with temp_environ(), PipenvInstance(chdir=True) as p: mirror_url = os.environ.pop('PIPENV_TEST_INDEX', "https://pypi.kennethreitz.org/simple") assert 'pypi.org' not in mirror_url with open(p.pipfile_path, 'w') as f: @@ -45,10 +45,10 @@ def test_mirror_lock_sync(PipenvInstance, pypi): @pytest.mark.sync @pytest.mark.lock -def test_sync_should_not_lock(PipenvInstance, pypi): +def test_sync_should_not_lock(PipenvInstance): """Sync should not touch the lock file, even if Pipfile is changed. """ - with PipenvInstance(pypi=pypi, chdir=True) as p: + with PipenvInstance(chdir=True) as p: with open(p.pipfile_path, 'w') as f: f.write(""" [packages] @@ -73,8 +73,8 @@ def test_sync_should_not_lock(PipenvInstance, pypi): @pytest.mark.sync @pytest.mark.lock -def test_sync_sequential_detect_errors(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_sync_sequential_detect_errors(PipenvInstance): + with PipenvInstance() as p: with open(p.pipfile_path, 'w') as f: contents = """ [packages] @@ -97,8 +97,8 @@ def test_sync_sequential_detect_errors(PipenvInstance, pypi): @pytest.mark.sync @pytest.mark.lock -def test_sync_sequential_verbose(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_sync_sequential_verbose(PipenvInstance): + with PipenvInstance() as p: with open(p.pipfile_path, 'w') as f: contents = """ [packages] diff --git a/tests/integration/test_uninstall.py b/tests/integration/test_uninstall.py index d850ed0cbf..ef7fb688e6 100644 --- a/tests/integration/test_uninstall.py +++ b/tests/integration/test_uninstall.py @@ -11,8 +11,8 @@ @pytest.mark.run @pytest.mark.uninstall @pytest.mark.install -def test_uninstall(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_uninstall(PipenvInstance): + with PipenvInstance() as p: c = p.pipenv("install requests") assert c.return_code == 0 assert "requests" in p.pipfile["packages"] @@ -38,7 +38,7 @@ def test_uninstall(PipenvInstance, pypi): @pytest.mark.run @pytest.mark.uninstall @pytest.mark.install -def test_mirror_uninstall(PipenvInstance, pypi): +def test_mirror_uninstall(PipenvInstance): with temp_environ(), PipenvInstance(chdir=True) as p: mirror_url = os.environ.pop( @@ -102,8 +102,8 @@ def test_uninstall_all_local_files(PipenvInstance, testsroot): @pytest.mark.run @pytest.mark.uninstall @pytest.mark.install -def test_uninstall_all_dev(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_uninstall_all_dev(PipenvInstance): + with PipenvInstance() as p: c = p.pipenv("install --dev requests six") assert c.return_code == 0 @@ -135,8 +135,8 @@ def test_uninstall_all_dev(PipenvInstance, pypi): @pytest.mark.uninstall @pytest.mark.run -def test_normalize_name_uninstall(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi) as p: +def test_normalize_name_uninstall(PipenvInstance): + with PipenvInstance() as p: with open(p.pipfile_path, "w") as f: contents = """ # Pre comment diff --git a/tests/integration/test_windows.py b/tests/integration/test_windows.py index 80fc4053c9..b303d0ab11 100644 --- a/tests/integration/test_windows.py +++ b/tests/integration/test_windows.py @@ -13,10 +13,10 @@ @pytest.mark.project -def test_case_changes_windows(PipenvInstance, pypi): +def test_case_changes_windows(PipenvInstance): """Test project matching for case changes on Windows. """ - with PipenvInstance(pypi=pypi, chdir=True) as p: + with PipenvInstance(chdir=True) as p: c = p.pipenv('install pytz') assert c.return_code == 0 @@ -40,7 +40,7 @@ def test_case_changes_windows(PipenvInstance, pypi): @pytest.mark.files -def test_local_path_windows(PipenvInstance, pypi): +def test_local_path_windows(PipenvInstance): whl = ( Path(__file__).parent.parent .joinpath('pypi', 'six', 'six-1.11.0-py2.py3-none-any.whl') @@ -49,13 +49,13 @@ def test_local_path_windows(PipenvInstance, pypi): whl = whl.resolve() except OSError: whl = whl.absolute() - with PipenvInstance(pypi=pypi, chdir=True) as p: + with PipenvInstance(chdir=True) as p: c = p.pipenv('install "{0}"'.format(whl)) assert c.return_code == 0 @pytest.mark.files -def test_local_path_windows_forward_slash(PipenvInstance, pypi): +def test_local_path_windows_forward_slash(PipenvInstance): whl = ( Path(__file__).parent.parent .joinpath('pypi', 'six', 'six-1.11.0-py2.py3-none-any.whl') @@ -64,14 +64,14 @@ def test_local_path_windows_forward_slash(PipenvInstance, pypi): whl = whl.resolve() except OSError: whl = whl.absolute() - with PipenvInstance(pypi=pypi, chdir=True) as p: + with PipenvInstance(chdir=True) as p: c = p.pipenv('install "{0}"'.format(whl.as_posix())) assert c.return_code == 0 @pytest.mark.cli -def test_pipenv_clean_windows(PipenvInstance, pypi): - with PipenvInstance(pypi=pypi, chdir=True) as p: +def test_pipenv_clean_windows(PipenvInstance): + with PipenvInstance(chdir=True) as p: c = p.pipenv('install requests') assert c.return_code == 0 c = p.pipenv('run pip install click') diff --git a/tests/pypi b/tests/pypi index fbd3539075..2c4b6de4d8 160000 --- a/tests/pypi +++ b/tests/pypi @@ -1 +1 @@ -Subproject commit fbd3539075d67494119b0c642707a449bcbd0bd4 +Subproject commit 2c4b6de4d88d7d5732bdf0c9345ad10f8336abd3 diff --git a/tests/test_artifacts/git/requests b/tests/test_artifacts/git/requests index 57d7284c1a..4983a9bde3 160000 --- a/tests/test_artifacts/git/requests +++ b/tests/test_artifacts/git/requests @@ -1 +1 @@ -Subproject commit 57d7284c1a245cf9fbcecb594f50471d86e879f7 +Subproject commit 4983a9bde39c6320aa4f3e34e50dac6e263dab6f diff --git a/tests/test_artifacts/git/six b/tests/test_artifacts/git/six index e114efceea..aa4e90bcd7 160000 --- a/tests/test_artifacts/git/six +++ b/tests/test_artifacts/git/six @@ -1 +1 @@ -Subproject commit e114efceea962fb143c909c904157ca994246fd2 +Subproject commit aa4e90bcd7b7bc13a71dfaebcb2021f4caaa8432