Commit Graph

107 Commits

Author SHA1 Message Date
Damian Shaw 68529081c2
Enforce f-strings via Ruff (#12393) 2023-11-07 09:14:56 +00:00
Lukas Geiger 3d6b0be901 Remove outdated noqa comments 2023-09-22 01:28:54 +01:00
Stéphane Bidoul 108c055f72 Revert "xfail test_pip_wheel_ext_module_with_tmpdir_inside"
This reverts commit fab519dfd9.
2023-06-27 15:10:38 +02:00
Paul Moore bdef9159bd Use ruff for import sorting as well 2023-06-05 15:06:11 +01:00
Stéphane Bidoul 3fd8fde14b Remove with_wheel fixture
We install wheel by default in our test env.
2023-03-27 11:55:20 +01:00
Stéphane Bidoul 82b42c80f9
xfail test_pip_wheel_ext_module_with_tmpdir_inside (#11895) 2023-03-27 11:33:11 +01:00
Tzu-ping Chung 42359a9605 Migrate tests to use pathlib.Path
The pip-specific Path implementation has been removed, and all its
usages replaced by pathlib.Path. The tmpdir and tmpdir_factory fixtures
are also removed, and all usages are replaced by tmp_path and
tmp_path_factory, which use pathlib.Path.

The pip() function now also accepts pathlib.Path so we don't need to put
str() everywhere. Path arguments are coerced with os.fspath() into str.
2022-06-08 19:58:46 +08:00
Jon Dufresne c71cf88049 Complete type annotations of tests/functional/ directory 2021-11-18 18:26:17 -08:00
Pradyun Gedam bc98892d0b
Drop --build-dir from the CLI
This was restored as a no-op for PyCharm, as a way to soften the
migration for them. It is no longer necessary, since the migration has
completed.
2021-10-04 22:35:48 +01:00
Tzu-ping Chung fbdc4648c2 Remove --build xfail for now
The option is current restored. We should remove this test after the
option is removed (again).
2021-09-30 15:55:57 +08:00
Jon Dufresne fa0804b98c Use @pytest.mark.usefixture("with_wheel") in tests
The with_wheel fixture doesn't have a value and isn't ever referenced
within a test function.

To avoid typing it every test function, change tests to use
pytest.mark.usefixture. It will no longer appear as an argument.

https://docs.pytest.org/en/latest/how-to/fixtures.html#use-fixtures-in-classes-and-modules-with-usefixtures
2021-09-20 21:44:29 -07:00
Jon Dufresne ad25b61e07 Remove unused tmpdir fixtures from tests
There was also one unused monkeypatch fixture removed.
2021-09-05 07:08:06 -07:00
Pradyun Gedam 94999255d5
Reformat the codebase, with black 2021-08-20 13:37:49 +01:00
Andrey Bienkowski 9b2cb894ba Convert more str.format() calls to f-strings 2021-02-13 09:27:17 +03:00
Pradyun Gedam 3af9093a73
Merge pull request #9274 from sbidoul/pip-wheel-must-keep-clone-sbi 2021-01-17 15:30:57 +00:00
Stéphane Bidoul e47734ed03
Add failing test that pip wheel -e keeps git clone in src 2020-12-27 17:13:29 +01:00
Pradyun Gedam 86afa89043
Merge pull request #9361 from jdufresne/f-strings
Use f-strings for simple string formatting
2020-12-26 10:24:18 +00:00
Jon Dufresne 1f9d6e4aea Remove unnecessary str() call around str literal
Unnecessary since dropping Python 2.
2020-12-25 16:52:35 -08:00
Jon Dufresne cdcf74fb8e Use f-strings for simple string formatting
Use pyupgrade to convert simple string formatting to use f-string
syntax. pyupgrade is intentionally timid and will not create an f-string
if it would make the expression longer or if the substitution parameters
are anything but simple names or dotted names.
2020-12-25 16:21:20 -08:00
Stéphane Bidoul 11d07016d9
Add failing test for issue 9122 2020-11-12 13:20:45 +01:00
Pradyun Gedam 5cba61e118
Switch to resolver variants in the test suite 2020-10-30 07:16:19 +05:30
Paul Moore 0c2a2bc803 Mark a couple of tests that still use --build as xfail 2020-10-27 15:24:36 +00:00
Paul Moore 7c4c5b8330 Remove test_pip_wheel_fail_cause_of_previous_build_dir as it's no longer valid 2020-10-27 15:24:36 +00:00
Tzu-ping Chung da23209fbe Expect deprecation warning for build_dir in tests 2020-06-23 20:18:42 +08:00
Stéphane Bidoul acab2ee54e Deprecate --build-dir 2020-06-21 19:05:55 +02:00
Paul Moore e97b365529 Mark a few more tests as working under the new resolver 2020-06-10 13:08:37 +01:00
Stéphane Bidoul 2946038f25
Merge pull request #8366 from gutsytechster/add_helper_method_to_uninstall_and_wheel
Add helper methods for path lookups to test_{uninstall, wheel}.py
2020-06-09 22:20:26 +02:00
Tzu-ping Chung daf454bb3b Mark build dir tests as passing for new resolver
The new resolver uses UUID to allow parallel build directories, so this
error will no longer occur.
2020-06-04 23:26:19 +08:00
gutsytechster 51897fcb63 refactor(test_wheel.py): Add helper methods for path lookups 2020-05-30 23:44:43 +05:30
Paul Moore c2fa0dd997 Add a mark for tests that fail on the new resolver 2020-05-21 15:39:00 +01: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
Jason R. Coombs 6282a307dc 👹 Feed the hobgoblins (delint). 2020-03-06 12:43:10 -05:00
Jason R. Coombs 3511d3d493 Convert the remaining '%' formatters to '.format'. Fixes #6973. 2020-03-06 12:43:03 -05:00
Chris Hunt 98cd193727 Remove delete_marker_file writing in tests
Nothing checks for this file, so no need to write it.
2020-02-05 20:14:44 -05:00
Stéphane Bidoul (ACSONE) 1ee270a8d4
Check that the cache is writable in _main()
This avoid code duplication (for the wheel and http
cache) and repeated warnings.
2019-12-28 13:04:54 +01:00
Stéphane Bidoul (ACSONE) 865539bdad
Test that pip wheel succeeds when cache dir is not writeable 2019-12-28 13:04:40 +01:00
Stéphane Bidoul (ACSONE) 32cabbf716
Add test for pip wheel with non-absolute cache dir 2019-12-14 12:47:14 +01:00
Christopher Hunt d7eaede434
Revert "Add new option: pip wheel --save-wheel-names (#6377)" (#7420)
This reverts commit bcad1b1cb5, reversing
changes made to f86490317a.

As discussed, we should rethink the interface of this command output as
part of larger CLI usability review. In the interim, the same
functionality can be achieved using straightforward shell commands.
2019-12-13 07:57:05 +08:00
Stéphane Bidoul (ACSONE) ba60397dd4
Make pip wheel cache what it built
Just like pip install.
2019-11-03 22:08:42 +01:00
Patrik Kopkan 9a2181a087 Add new option: pip wheel --save-wheel-names 2019-09-25 13:39:34 +02:00
Xavier Fernandez 34092d3234 Move pip marker related constant & function in their own module
It didn't seem related with the rest of the locations module
2019-07-18 22:53:05 +02:00
Pradyun Gedam bc88399d07
Change Path.makedirs() -> Path.mkdir(parents=True) 2019-07-12 13:30:18 +05:30
Chris Hunt 39ac9ca351 Rename compatible functions in tests.lib.path.Path. 2019-07-02 18:48:44 -04:00
Ian Wienand 0dbab23df9 Add SHA256 hash of .whl as info output (#5908)
* Add SHA256 hash of .whl as info output

Currently I'm trying to debug some issues with what appear to be
corrupt wheels.  It would be very useful to see what pip thought the
state of things was as it wrote the wheel output; if a final corrupt
distributed file is then different to what pip has saved in its build
logs, you know the problem is somewhere after pip but before
distribution.

Currently we get a log of the initial creation, then the stamp when it
gets moved in the final output location, e.g.:

 creating '/tmp/pip-wheel-71CpBe/foo-1.2.3-py2.py3-none-any.whl
 ...
 Stored in directory: /opt/wheel/workspace

A lot happens in between this, so my suggestion is we add the final
output file and it's hash before the "Stored in directory:", e.g. you
now see:

 Building wheels for collected packages: simple
   Running setup.py bdist_wheel for simple: started
   Running setup.py bdist_wheel for simple: finished with status 'done'
   Finished: simple-3.0-py3-none-any.whl sha256=39005a57a6327972575072af82e11d0817439fe6a069381f6f2a123a8c0bf1cf
   Stored in directory: /tmp/pytest-of-iwienand/pytest-18/test_pip_wheel_success0/workspace/scratch
 Successfully built simple

Despite the hash being fairly important for things like
--require-hashes, AFAICS the final hash is not put in the logs at all
currently, so I think this is generically helpful.

* Reword wheel hash details output

This rewords the output to be more like the form of the preceding
messages.  Additionally the size is added, since we have calculated it
anyway.  The output will now look like:

 Collecting simple==3.0
 Building wheels for collected packages: simple
   Building wheel for simple (setup.py): started
   Building wheel for simple (setup.py): finished with status 'done'
   Created wheel for simple: filename=simple-3.0-py3-none-any.whl size=1138 sha256=2a980a802c9d38a24d29aded2dc2df2b080e58370902e5fdf950090ff67aec10
   Stored in directory: /tmp/pytest-of-iwienand/pytest-0/test_pip_wheel_success0/workspace/scratch
 Successfully built simple
2019-06-26 02:44:43 -07:00
Chris Jerdonek e0505bb152 Prevent subprocess stdout and stderr from cluttering pip's stdout. 2019-03-25 00:21:20 -07:00
Miro Hrončok 75c2201d5a Mark 3 tests as network tests
________________ test_constraints_local_editable_install_pep518 ________________
    ...
    ----------------------------- Captured stdout call -----------------------------
    Script result: python -m pip download setuptools wheel -d /tmp/pytest-of-mockbuild/pytest-0/test_constraints_local_editabl0/data/packages
      return code: 1
    -- stderr: --------------------
      Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fba7fdeb160>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
      Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fba7fdeb0b8>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
      Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fba7fdeb4e0>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
      Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fba7fdeb6d8>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
      Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fba7fdeb860>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
      Could not find a version that satisfies the requirement setuptools (from versions: )
    No matching distribution found for setuptools

    _____________ test_pep517_wheels_are_not_confused_with_other_files _____________
    ...
    -- stdout: --------------------
    Processing /tmp/pytest-of-mockbuild/pytest-0/test_pep517_wheels_are_not_con0/data/src/withpyproject
      Installing build dependencies: started
      Installing build dependencies: finished with status 'error'
      Complete output from command /tmp/pytest-of-mockbuild/pytest-0/test_pep517_wheels_are_not_con0/workspace/venv/bin/python /builddir/build/BUILDROOT/python-pip-19.0.2-1.fc30.x86_64/usr/lib/python3.7/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pytest-of-mockbuild/pytest-0/test_pep517_wheels_are_not_con0/workspace/tmp/pip-build-env-3un7dqu3/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel:
      Collecting setuptools
        Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb7cf5a8898>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
        Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb7cf5b9588>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
        Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb7cf5b9470>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
        Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb7cf5b9278>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
        Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fb7cf5b9208>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/setuptools/
        Could not find a version that satisfies the requirement setuptools (from versions: )
      No matching distribution found for setuptools

    ________________________ test_upgrade_argparse_shadowed ________________________
    ...
    ----------------------------- Captured stdout call -----------------------------
    Script result: python -m pip install argparse==1.3
      return code: 1
    -- stderr: --------------------
      Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7ff07d6db240>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/argparse/
      Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7ff07d6db358>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/argparse/
      Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7ff07d6db400>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/argparse/
      Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7ff07d6db518>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/argparse/
      Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7ff07d6c7710>: Failed to establish a new connection: [Errno -2] Name or service not known')': /simple/argparse/
      Could not find a version that satisfies the requirement argparse==1.3 (from versions: )
    No matching distribution found for argparse==1.3
2019-02-13 13:01:04 +01:00
Pradyun Gedam 51086b3718
Don't add wheels when checking if pip gets confused when building wheels
setuptools expects only one wheel file to be present in dist/
2019-02-05 08:35:01 +05:30
Pradyun Gedam 6463ffe195
Add failing tests for the behaviour to fix 2019-02-05 08:34:25 +05:30
Paul Moore a82b7ce5e7 Fix test_pep518_with_user_pip which was getting errors due to irrelevant changes in setuptools output 2018-10-29 23:32:13 +01:00