Commit Graph

42 Commits

Author SHA1 Message Date
ekristina 2e5b4461f4 Improve code reuse in TestSafeFileCache
Use a fixture creating a temporary directory for cache.
2019-05-04 17:11:44 -04:00
Caleb Martinez ac9010e87c Allow adding a custom string to pip's User-Agent via an environment variable (#5550) 2019-03-31 02:37:02 -07:00
Chris Jerdonek 821247dc36
Merge pull request #6273 from cjerdonek/issue-5499-detect-ci-for-user-agent
Fix #5499: Include in pip's User-Agent whether it looks like pip is in CI
2019-02-24 14:24:55 -08:00
Xavier Fernandez c286c55d51 Tweak tests & url_to_path after review 2019-02-24 21:40:25 +01:00
Benoit Pierre 61baf5fe80 improve handling of file URIs 2019-02-24 21:40:25 +01:00
Chris Jerdonek a229f114e6 Address review comments. 2019-02-18 19:29:07 -08:00
Chris Jerdonek 14a6aaabff Include in pip's User-Agent whether it looks like pip is in CI. 2019-02-17 07:16:01 -08:00
Chris Jerdonek a434431431 Use split_auth_from_netloc() inside MultiDomainBasicAuth(). 2018-10-29 22:13:51 -07:00
Pradyun Gedam 7f3df6d2e2
Don't import Link from pip._internal.index 2018-08-16 14:29:24 +05:30
Anthony Sottile e21e2d3f8f Upgrade syntax in ./tests
Changes were automated via https://github.com/asottile/pyupgrade

See #4921
2017-12-14 21:59:41 -08:00
Pradyun Gedam 353a13ddff
isort: Include trailing commas 2017-11-21 13:23:59 +05:30
Donald Stufft 95bcf8c5f6 Move all internal APIs to pip._internal 2017-08-31 14:53:00 -04:00
Pradyun S. Gedam 32c8f42729 Add a new create_file helper and use it 2017-06-14 10:13:04 +05:30
Pradyun S. Gedam 9923c1ad7e Sort imports and minor Flake8 changes (#4520)
* Run isort on the codebase

Command: isort --recursive --skip __main__.py --skip _vendor -o pip._vendor -sd THIRDPARTY -m 5 -p pip -p tests ./pip ./tests

* 📰
2017-06-13 14:17:00 +02:00
Alex Gaynor 588aed556c close some more files in the tests 2017-05-23 21:29:07 -07:00
Pradyun S. Gedam 1832569530 Sort all imports 2017-05-16 15:47:47 +05:30
Damian Quiroga 3cdd162a7b Expect and return str when handling URL credentials 2017-03-30 22:01:43 -03:00
Matthew Willson bdb708de94 Support url-encoded characters in URL credentials 2017-03-30 22:00:37 -03:00
Xavier Fernandez b998ab6807 Skip SafeFileCache no_perms tests on windows
Since Windows is lacking geteuid, it is useless.
2016-01-17 22:40:46 +01:00
Erik Rose 1e41f01823 Add checks against requirements-file-dwelling hashes for most kinds of packages. Close #1175.
* Add --require-hashes option. This is handy in deployment scripts to force application authors to hash their requirements. It is also a convenient way to get pip to show computed hashes for a virgin, unhashed requirements file. Eventually, additions to `pip freeze` should fill a superset of this use case.
  * In --require-hashes mode, at least one hash is required to match for each requirement.
  * Option-based requirements (--sha256=...) turn on --require-hashes mode implicitly.
  * Internet-derived URL-based hashes are "necessary but not sufficient": they do not satisfy --require-hashes mode when they match, but they are still used to guard against transmission errors.
  * Other URL-based requirements (#md5=...) are treated just like flag-based ones, except they don't turn on --require-hashes.
* Complain informatively, with the most devastating errors first so you don't chase your tail all day only to run up against a brick wall at the end. This also means we don't complain that a hash is missing, only for the user to find, after fixing it, that we have no idea how to even compute a hash for that type of requirement.
  * Complain about unpinned requirements when hash-checking mode is on, lest they cause the user surprise later.
  * Complain about missing hashes.
  * Complain about requirement types we don't know how to hash (like VCS ones and local dirs).
* Have InstallRequirement keep its original Link around (original_link) so we can differentiate between URL hashes from requirements files and ones downloaded from the (untrustworthy) internet.
* Remove test_download_hashes, which is obsolete. Similar coverage is provided in test_utils.TestHashes and the various hash cases in test_req.py.
2015-09-24 22:16:00 -04:00
Donald Stufft 0bc8aa5622 Style fixes for the latest flake8 2015-02-24 07:46:10 -05:00
Donald Stufft 8d3de97d34 Adjust tests to compensate for --trusted-hosts 2014-12-20 18:03:38 -05:00
Paul Moore c285a5e5f2 Typo fix 2014-12-18 16:52:26 +00:00
Davidovich 1689291381 Refactored PR to use url2pathname and pathname2url. 2014-12-18 10:51:57 -05:00
Donald Stufft ec91d8e421 Move from pip.compat.* to six.moves.* for urllib related stuff 2014-09-11 18:40:45 -04:00
Donald Stufft 53faeece34 Clean up some no longer needed compatability code 2014-07-03 12:20:03 -04:00
Matthew Iversen b7770c502a Remove unnecessary imports, move some to six 2014-06-07 04:21:51 +10:00
Matthew Iversen dcb0ee0702 Move backwardcompat package to compat module 2014-05-14 13:10:06 +10:00
Donald Stufft 52ca02608e Use CacheControl instead of custom cache code
* Deprecates the --download-cache option & removes the download
  cache code.
* Removes the in memory page cache on the index
* Uses CacheControl to cache all cacheable HTTP requests to the
  filesystem.
  * Properly handles CacheControl headers for unconditional
    caching.
  * Will use ETag and Last-Modified headers to attempt to do a
    conditional HTTP request to speed up cache misses and turn
    them into cache hits.
  * Removes some concurrency unsafe code in the download cache
    accesses.
  * Uses a Cache-Control request header to limit the maximum
    length of time a cache is valid for.
* Adds pip.appdirs to handle platform specific application
  directories such as cache, config, data, etc.
2014-05-09 18:28:20 -04:00
Donald Stufft 22c562429a Use Accept-Encoding: identity when requesting files 2014-03-27 11:34:51 -04:00
Donald Stufft 95035fc5c4 Turn on everything in flake8
flake8 ignores some errors by default, these ignored by defaults
change sometimes. This will make things stabler by selecting
everything.
2014-02-24 16:52:23 -05:00
Marcus Smith eb7a31e019 when file urls have hash fragments, check it 2014-02-01 14:04:58 -08:00
Marcus Smith e41bf0230e 'pip wheel' should download wheels, when it finds them 2014-02-01 11:41:55 -08:00
Donald Stufft 9f027337a8 Use Flake8 on the test of pip's Python files 2014-01-28 19:47:58 -05:00
Donald Stufft aa6136014f Use the raw stream to prevent decoding the response 2014-01-07 11:57:25 -05:00
Marcus Smith ade1bcf987 backwardcompat fixes for py3 2013-11-20 15:36:09 -08:00
Marcus Smith 73b8692d86 a single `path_to_url` function with tests 2013-11-18 22:12:41 -08:00
Donald Stufft ff2854a855 Use requests instead of urllib2 2013-09-24 23:32:03 -04:00
Donald Stufft 487925ea3f Isolate the tests from the shared data directory 2013-08-27 06:49:35 -04:00
Carl Meyer b3a791223c Cached or already-downloaded files with bad hashes are ignored. 2013-05-30 17:00:10 -06:00
Carl Meyer 388d1b53a7 Refactor unpack_http_url. 2013-05-30 16:59:57 -06:00
Marcus Smith 28298c413d more functional/unit tests restructure 2013-05-29 13:41:13 -07:00