Commit Graph

2940 Commits

Author SHA1 Message Date
Devesh Kumar Singh 29b4ec79ed Fixed issue in test_show for failing test 2020-04-06 00:27:30 +05:30
Devesh Kumar Singh 2324ae422e Add unit tests for pip commands not using cwd 2020-04-05 23:17:03 +05:30
Pradyun Gedam eb865b4e10
Merge pull request #7955 from deveshks/pip-list-not-contain-pkg-work-dir
Don't list packages in current directory
2020-04-05 21:13:14 +05:30
Devesh Kumar Singh feac595446 Don't use cwd in python -m pip command 2020-04-05 19:59:05 +05:30
Ilan Schnell 2b883d5d8a add ability to test uninstall - and simple uninstall test 2020-04-05 00:05:43 -05:00
Ilan Schnell 0c3bc448e1 always check for files in site-packages - add simple test for installing twice 2020-04-04 14:33:28 -05:00
Nikolay Korolev e454181ba6 Fix coding style 2020-04-04 22:30:57 +03:00
Nikolay Korolev f8bb362fef Fix Python 2 compatibility in tests 2020-04-04 22:26:03 +03:00
Nikolay Korolev 3bc3cee5ae Add logging thread-safety tests 2020-04-04 22:18:12 +03:00
Ilan Schnell a0fe4112d1 better naming in yaml-files: transaction -> response, install -> state 2020-04-04 14:00:16 -05:00
Tzu-ping Chung aaa82cddcc isort 2020-04-04 20:52:39 +08:00
Tzu-ping Chung 2430aba879 Implement editable candidate 2020-04-04 17:51:43 +08:00
Paul Moore 037791d170 Add a test demonstrating #7966 2020-04-03 11:18:44 +01:00
Tzu-ping Chung f061f3f691 Fetch install dist for a candidate if available
The candidate creation logic is further moved into the factory. The
factory would use pkg_resources.get_distribution() to find a matching
distribution for a givan InstallationCandidate. If found, the Candidate
would be created based on that found distribution, instead of the link.

--ignore-installed is implemented as to always use the link to create
candidates, even if an installed distribution is found.
2020-04-03 00:36:26 +08:00
Tzu-ping Chung 557f7670ea Typo in comment 2020-04-02 21:44:54 +08:00
Tzu-ping Chung 34c24f6e79 Switch to create_basic_wheel_for_package 2020-04-02 18:40:48 +08:00
Tzu-ping Chung 22f7c883ad Requires-Python support in test helper 2020-04-02 18:38:43 +08:00
Tzu-ping Chung 630339e577 Add new resolver test for Requires-Python 2020-04-02 18:36:08 +08:00
Tzu-ping Chung 190c424b1e Implement Python as a dependency
If a dist contains Requires-Python metadata, it is converted into a
Requirement for the resolver based on whether the Requires-Python
is compatible or not.

If it is compatible, an ExplicitRequirement is returned to hold the
Python information (either sys.version_info, or the user-supplied
--python-version).

If it is incompatible, a special NoMatchRequirement is returned, which
never matches to anything, generating a ResolutionImpossible to report
the Python version incompatibility.

The --ignore-requires-python flag is implemented as to not return a
Requirement for Requires-Python at all.
2020-04-02 18:36:08 +08:00
Paul Moore 2a1f3c22a6
Merge pull request #7910 from uranusjr/resolver-refactor-factory
Second round of resolver refactor factory
2020-04-02 11:27:04 +01:00
Paul Moore ac26f1bc33
Merge pull request #7934 from uranusjr/create_basic_wheel_for_package_improve
Rewrite tests.lib.create_basic_wheel_for_package
2020-04-02 11:25:36 +01:00
Ilan Schnell 3f2129e040 make flake8 happy 2020-04-02 00:34:55 -05:00
Ilan Schnell 4a0dd98534 add ability to run pip with options for yaml tests 2020-04-02 00:09:24 -05:00
Stéphane Bidoul 196706d305
Better freeze using direct_url.json 2020-04-01 22:57:00 +02:00
Stéphane Bidoul a0ed759fb3
Add direct_url support to InstallRequirement
pass it to install_wheel via install
2020-04-01 22:57:00 +02:00
Stéphane Bidoul 94b77130aa
Add WheelCache method to inform which cache was used
Return whether the link was found in the persistent or ephemeral cache.
2020-04-01 22:57:00 +02:00
Stéphane Bidoul f77944733d
Add DirectUrl support to install_wheel 2020-04-01 22:56:59 +02:00
Stéphane Bidoul bd4d52b09c
Add helper to get DirectUrl metadata from Distrribution 2020-04-01 22:56:59 +02:00
Stéphane Bidoul 88582c2564
Add helper to create a DirectUrl from a Link 2020-04-01 22:56:59 +02:00
Stéphane Bidoul 6f689f61db
Add helper to convert DirectUrl to PEP 440 direct reference 2020-04-01 22:56:59 +02:00
Stéphane Bidoul 6b7f4ce81b
Add DirectUrl model, implementing PEP 610 2020-04-01 22:56:59 +02:00
Ellen Marie Dash b988417b4f [tests/functional/test_cache] Use os.path.join() instead of hard-coding the path separator. 2020-04-01 16:54:42 -04:00
Ellen Marie Dash 0c4eafad62 [tests/functional/test_cache] Fix test on Python 2.7. 2020-04-01 16:54:42 -04:00
Ellen Marie Dash b7239f5dee [tests/functional/test_cache] Remove unused import. 2020-04-01 16:54:42 -04:00
Ellen Marie Dash 8858237903 [tests/functional/test_cache] Refactor list_matches_wheel() and remove_matches_wheel(). 2020-04-01 16:54:42 -04:00
Ellen Marie Dash a20b28d008 [tests/functional/test_cache] Split apart tests for `pip cache purge`. 2020-04-01 16:54:42 -04:00
Ellen Marie Dash ba7c3ac9ec [tests/functional/test_cache] Add test `pip cache list` with an empty cache. 2020-04-01 16:54:42 -04:00
Ellen Marie Dash 32ce3bacbe [tests/functional/cache] Rewrite all of the pip cache {list,remove} tests. 2020-04-01 16:54:42 -04:00
Ellen Marie Dash c6b5a52a5a [tests/functional/test_cache] Always call normcase on cache dir; fix line length problems. 2020-04-01 16:54:42 -04:00
Ellen Marie Dash 274b295bd8 [tests/functional/cache] Make fixtures feel less magical.
It bothered me that _whether or not a function had a certain argument_
dictated the contents of a directory. Pytest fixtures are inherently
kinda magical, but that was a bit much for me.
2020-04-01 16:54:42 -04:00
Ellen Marie Dash 6e425d8009 [tests/functional/cache] Refactor to be less redundant. 2020-04-01 16:54:42 -04:00
Ellen Marie Dash 8b518b258d [commands/cache] Make filenames more realistic in tests. 2020-04-01 16:54:42 -04:00
Ellen Marie Dash f8b67c8bf1 [commands/cache] Fix test_cache_info test. 2020-04-01 16:54:42 -04:00
Ellen Marie Dash d74895a224 [commands/cache] Normalize path in test. 2020-04-01 16:54:42 -04:00
Ellen Marie Dash 2d978309a2 [commands/cache] Minor clean-up.
- Consistently use singular 'cache' (not plural 'caches').
- Remove unnecessary uses of the word 'currently'.
- Use 'file(s)' instead of 'files', to account for case of only one file.
- Use .format() when appropriate.
- Minor cleanup of `pip cache`-related files in docs/.
2020-04-01 16:54:42 -04:00
Ellen Marie Dash 6fb1ee7a3d [commands/cache] fix linting error. 2020-04-01 16:54:04 -04:00
Ellen Marie Dash 50604be6c4 [commands/cache] Raise errors if wrong number of args.
Also add tests for purge_cache, since I apparently forgot those before.
2020-04-01 16:54:03 -04:00
Ellen Marie Dash b9b29b8c10 [commands/cache] fix 'pip cache info'; don't hide python/abi/platform tags. 2020-04-01 16:54:03 -04:00
Ellen Marie Dash b0e7b66326 [commands/cache] Refactor + fix linting failures. 2020-04-01 16:54:03 -04:00
Ellen Marie Dash 04c0b0e6eb Add 'pip cache' command. 2020-04-01 16:54:03 -04:00
Tzu-ping Chung 09f4d0004b Use extra_files to write package files instead 2020-04-02 01:25:05 +08:00
Paul Moore 657cf2515b
Merge pull request #7929 from McSinyx/tmp-file
Use better temporary files mechanism
2020-04-01 16:47:30 +01:00
Nguyễn Gia Phong 209c74f690 Use better temporary files mechanism 2020-04-01 22:02:34 +07:00
Pradyun Gedam 7b02273f3e
Merge pull request #7927 from deveshks/raise-exception-if-rev-empty-git-url
Raise an exception if revision is empty in git url
2020-04-01 18:17:36 +05:30
Tzu-ping Chung d29c86af98 Add method to create requirement from spec 2020-04-01 16:53:39 +08:00
Tzu-ping Chung 32c46403c5 Fix factory fixture for wheel_cache refactoring 2020-04-01 16:00:48 +08:00
Ilan Schnell 83ba23989d remove extra whitespace 2020-03-31 15:55:16 -05:00
Ilan Schnell 9de02c2b41 better naming of constant 2020-03-31 15:47:43 -05:00
Ilan Schnell 2a8f5705b2 combine yaml test functionality into single module 2020-03-31 15:35:29 -05:00
Paul Moore 534561cbec
Merge pull request #7945 from uranusjr/unit-tests-new-resolver
Rename unit tests to use the new_resolver scheme
2020-03-31 10:55:09 +01:00
Pradyun Gedam 0f7fac3a3d
Merge pull request #7801 from uranusjr/yanked-link-refactor
Move wheel cache out of InstallRequirement
2020-03-31 15:14:37 +05:30
Tzu-ping Chung 64c78a5875 Rename unit tests to use the new_resolver scheme 2020-03-31 16:19:41 +08:00
Ilan Schnell 6db7f42186 sort imports 2020-03-31 01:42:40 -05:00
Ilan Schnell 2c6a063a27 remove proxy module tests/lib/scripttest.py in favour of importing from tests.lib directly 2020-03-31 01:25:45 -05:00
Devesh Kumar Singh 0d2ca67729 Changed ValueError to InstallationError 2020-03-30 22:29:40 +05:30
Pradyun Gedam 57cb941645
Merge pull request #7891 from deveshks/ignore-uninstall-error-if-easy-install-missing
Don't fail uninstallation if easy-install.pth doesn't exist
2020-03-30 21:42:38 +05:30
Tzu-ping Chung 1514d85a08 Fix wheel_cache argument for the new resolver 2020-03-30 17:37:28 +08:00
Tzu-ping Chung 6db0df928c Move wheel cache out of InstallRequirment 2020-03-30 17:36:03 +08:00
Devesh Kumar Singh 0d2954d726 Add test to ensure egg-link is removed after uninstall 2020-03-30 01:31:08 +05:30
Tzu-ping Chung 2c8a0bff42 Rewrite tests.lib.create_basic_wheel_for_package
This implementation uses tests.lib.make_wheel, which allows more
flexible wheel configuration in a more structured way.

Output-wise this should be almost identical to the previous
implementation, with the following exceptions:

* Metadata-Version is bumped from 2.0 (previous implementation) to 2.1
  (from make_wheel).
* Fields previously supplied as UNKNOWN are now omitted since they are
  not significant to tests.
* The DESCRIPTION file is omitted (since the description field is now
  missing, see previous point).
2020-03-30 03:20:00 +08:00
gutsytechster 315447d170 fix(tests/lib): Catch `subprocess.CalledProcessError` in need_executable
This fixes https://github.com/pypa/pip/issues/7924
2020-03-29 16:21:02 +05:30
Devesh Kumar Singh 106bd0d77f Raise an exception if revision is empty in git url 2020-03-29 12:04:48 +05:30
Ilan Schnell b328a50125 add simple yaml test 2020-03-28 01:15:28 -05:00
Devesh Kumar Singh 0acfdcd719 Check for uninstalled package after deleting pth file 2020-03-28 11:07:52 +05:30
Devesh Kumar Singh bcb4009688 Add a test case for missing easy-install.pth fix 2020-03-28 02:14:29 +05:30
Paul Moore 904d1c8c0a
Merge pull request #7907 from uranusjr/resolver-refactor-factory
Initial refactoring to decouple candidate and requirement modules
2020-03-27 14:18:41 +00:00
Tzu-ping Chung f32beda075 Remove unused provider fixture from argumnet lists 2020-03-27 18:57:53 +08:00
Tzu-ping Chung b1272a98f9 Make factory available in tests as a fixture 2020-03-27 03:53:01 +08:00
Tzu-ping Chung 4fd12fbf56 Fix PipProvider signature in test fixture 2020-03-27 03:34:27 +08:00
Noah Gorny 2050ecc7d7 tests: session: Remake test_insecure_host into test_trusted_host 2020-03-26 21:29:32 +02:00
Tzu-ping Chung 231ce27829 Delete unused improt and test util
This util function is already broken by previous signature changes to
make_requirement() anyway.
2020-03-27 03:25:43 +08:00
Noah Gorny c936ed0165 session: Rename _insecure_adapter to _trusted_host_adapter
Currently it is just the insecure adapter, but this can change in the future
2020-03-26 21:15:38 +02:00
Tzu-ping Chung 79f2553228 Use set operations in tests for readability 2020-03-27 02:39:33 +08:00
Paul Moore fea9766fa2 Merge branch 'master' into new_resolver_extras 2020-03-26 15:49:43 +00:00
Paul Moore a68345e81c Warn if invalid extras are given 2020-03-26 14:53:24 +00:00
Paul Moore 7e97cf6426 Ignore invalid extras 2020-03-26 11:57:34 +00:00
Tzu-ping Chung 6d3a89c992 Add --no-deps test for the new resolver 2020-03-26 01:48:47 +08:00
Tzu-ping Chung 1a210d1c62 Improve utility to test installed env
Make assert_installed actually check the provided entries against the
pip --list output.

Add assert_not_installed to check for the reverse.
2020-03-26 01:47:22 +08:00
Paul Moore 653bac26c9 Add a test to validate if extras are respected 2020-03-25 12:27:23 +00:00
Tzu-ping Chung 3cb7a08f0d Implement ignore_dependencies in new resolver
If this flag is set, simply report every candidate has no dependencies.
2020-03-24 02:02:36 +08:00
Tzu-ping Chung 5af542ccac Use named arguments for clarity 2020-03-24 02:00:08 +08:00
Paul Moore 0b1306bbf0 I must remember to run lint locally before pushing :-( 2020-03-20 11:12:38 +00:00
Paul Moore 89f4f16e3e Add some functional tests for the new resolver 2020-03-20 11:00:07 +00:00
Miro Hrončok eb070d2372 Avoid a test dependency on a C compiler, skip the test on Windows 2020-03-19 23:50:41 +01:00
Miro Hrončok 98aa09cf88 Prevent infinite recursion with pip wheel with $TMPDIR in $PWD
During a build of extension module within `pip wheel` the source directory is
recursively copied in a temporary directory.

See https://github.com/pypa/pip/issues/7555

When the temporary directory is inside the source directory
(for example by setting `TMPDIR=$PWD/tmp`) this caused an infinite recursion
that ended in:

    [Errno 36] File name too long

We prevent that buy never copying the target to the target in _copy_source_tree.

Fixes https://github.com/pypa/pip/issues/7872
2020-03-19 18:07:56 +01:00
Paul Moore cec27c747c Added an end-to-end install test of the new resolver 2020-03-18 14:54:29 +00:00
Paul Moore 098d00d8c3 Add a test that runs the full resolver 2020-03-18 14:42:20 +00:00
Paul Moore 7d2eb544b5 Implement PipProvider 2020-03-18 14:42:16 +00:00
Tzu-ping Chung ffb3692e00 Add simple tests for get_installation_order()
The implementation is improved a bit to make the sorting result more
predictable for easier testing.
2020-03-15 23:01:57 +08:00
Pradyun Gedam 4f6bef6eb4
Merge pull request #7792 from pradyunsg/misc/utils-tags
Rename pep425tags -> utils.compatibility_tags
2020-03-12 14:46:52 +05:30