-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Adopt usedevelop=False
for tests running in CI
#3015
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -466,7 +466,7 @@ def test_setup_requires_honors_fetch_params(self, mock_index, monkeypatch): | |||
with contexts.environment(PYTHONPATH=temp_install_dir): | |||
cmd = [ | |||
sys.executable, | |||
'-m', 'setup', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test seems to rely on the fact that it runs from the project root (that contains a setup.py
) file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow. That test was really janky, relying on Setuptools' own setup.py (with all its distribution setup) just to ignore it and invoke easy_install. Yes, I believe this change is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moreover: runpy
also injects the CWD into PYTHONPATH
(which will effectively be prepended to temp_install_dir
that the CM above puts there).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am afraid the only way of preventing this from happening would be either adopting a src-layout or using the changedir
trick proposed in the original issue.
The problem with the changedir
being that it breaks pytest-enabler
and (a single) doctest...
P.S.: The solution proposed by @webknjaz of separating the CI in 2 stages (build, test) and rm
-ing the files that are not part of the tests would also work, I think...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the rename of fixtures -> conftest, I've had issues in the (distant) past with conftest not in the root or in the root of tests. I did prefer having the fixtures in a module by that name, and to be importing them explicitly as plugins, but I don't feel strongly about it, so if this technique works, let's do it.
@@ -466,7 +466,7 @@ def test_setup_requires_honors_fetch_params(self, mock_index, monkeypatch): | |||
with contexts.environment(PYTHONPATH=temp_install_dir): | |||
cmd = [ | |||
sys.executable, | |||
'-m', 'setup', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow. That test was really janky, relying on Setuptools' own setup.py (with all its distribution setup) just to ignore it and invoke easy_install. Yes, I believe this change is better.
It seems that this technique does not work well in PyPy 😢. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abravalheri I'm working on providing generic [github] actions and reusable workflows for tox-based projects for a while now. Here's a demo: https://github.com/webknjaz/tox-gha-test/actions/runs/1636261551.
That effort is not yet publicly consumable but I just wanted to share that in case you'd want to borrow some ideas.
As a part of that, I've been developing a few supplementary actions that allow having a "proper" CI pipeline that builds the dists in the first stage, saves them as artifacts. Then the second stage with tests and linters uses those artifacts in two ways: (1) it unpacks the sdist from that artifact into the workspace directory making sure that it is possible to perform testing with what's published to PyPI and not what's in Git and (2) it allows to run tox against the wheel(s) using tox --installpkg <path/to/whl>
which essentially tells tox to skip building the artifact from the checkout folder. Those actions also allow building a wheel from an sdist in the artifact, among other things. The idea is that the third stage would be able to publish the same dists that have been tested and not rebuild them again from the source.
While you cannot use the actions+workflows, I thought I'd link them here to share the ideas: https://github.com/re-actors/build-python-dists / https://github.com/re-actors/checkout-python-sdist.
And here's something you can actually try recreating: https://github.com/cherrypy/cheroot/blob/7fa7914/.github/workflows/ci-cd.yml#L642. I guess it may be a good idea to rm -rf setuptools
in before invoking the tests, if you go this way.
543bbb3
to
22b6d3c
Compare
extras = testing | ||
passenv = | ||
SETUPTOOLS_USE_DISTUTILS | ||
PY_IGNORE_IMPORTMISMATCH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, I haven't heard of this thing. Is it documented anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😅 digging issues: pytest-dev/pytest#2042
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, looks like my google-fu let me down, thanks for this link!
Thank you very much @webknjaz. I think the idea of building a pipeline is something worth exploring in the long run (what are your thoughts @jaraco?). However it will not solve all the problems surfaced by this PR, for the following reasons:
In this scenario, using a src-layout would simplify things considerably, and even facilitate implementing a CI pipeline. However there are all the drawbacks discussed in #2318 (comment). For the short term I think it is a good idea to try to improve the isolation in a way that tox can run both locally or from the CI (so it becomes easier to debug problems). |
Update on the implementation:
I wonder if the last 2 errors happen because I added a MetaPathFinder... Is there a chance PyPy import system is getting confused? |
Ok I can confirm that the same error happens even if there is not messing with the
So my conclusion is that it seems to be a bug in |
Pytest automatically load `conftest.py` files from directory tests, so it is not necessary to use an in-tree pytest plugin for that. This issue was considered a blocker in pypa#2318.
… if modules are imported before the tested code runs.
When pytest runs on PyPy, the previous explored approach (i.e. renaming setuptools/tests/{fixtures => conftest}.py) fails. In this commit we explore the usage of a meta path finder to make sure pytest can load in-tree plugins (and test helpers) even when setuptools is installed from a distribution files (wheel or sdist).
e9ebaad
to
5579521
Compare
5579521
to
c38d053
Compare
I fixed everything I could, however there were still problems with My investigation seems to point out to In turn, this seems to be caused by PyPy 3.7 importing I could not replicate this in my machine, but it happens consistently in the CI (as pointed out by the logs mentioned in my previous comment). @jaraco could you please advise what would be your preference? As we previously discussed, there are advantages in testing the installed package, however the following changes add complexity:
So I don't have a particular strong opinion about merging x closing the PR. |
@@ -22,6 +22,8 @@ jobs: | |||
runs-on: ${{ matrix.platform }} | |||
env: | |||
SETUPTOOLS_USE_DISTUTILS: ${{ matrix.distutils }} | |||
PY_IGNORE_IMPORTMISMATCH: ${{ contains(matrix.python, 'pypy') && 1 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @kloczek, there is a problem with pytest that might be causing the problems you are seeing:
pytest-dev/pytest#2042
This seems to be related to the contents of your log.
I think you can try PY_IGNORE_IMPORTMISMATCH=1 as an env var to see how it goes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can try PY_IGNORE_IMPORTMISMATCH=1 as an env var to see how it goes.
Tested. Result with pytest
6.2.5 is exactly the same.
+ cd setuptools-60.5.4
+ export PY_IGNORE_IMPORTMISMATCH=1
+ PY_IGNORE_IMPORTMISMATCH=1
+ PYTHONDONTWRITEBYTECODE=1
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ pytest -ra -p no:randomly setuptools -W ignore::DeprecationWarning --import-mode=importlib
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/setuptools-60.5.4, configfile: pytest.ini
plugins: shutil-1.7.0, forked-1.4.0, cov-3.0.0, virtualenv-1.7.0, checkdocs-2.7.1, flake8-1.0.7, xdist-2.5.0
collected 155 items / 20 errors / 1 skipped / 134 selected
================================================================================== ERRORS ==================================================================================
___________________________________________________________ ERROR collecting setuptools/tests/test_bdist_egg.py ____________________________________________________________
ImportError while importing test module '/home/tkloczko/rpmbuild/BUILD/setuptools-60.5.4/setuptools/tests/test_bdist_egg.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
setuptools/tests/test_bdist_egg.py:11: in <module>
from . import contexts
E ImportError: attempted relative import with no known parent package
___________________________________________________________ ERROR collecting setuptools/tests/test_build_ext.py ____________________________________________________________
[..]
========================================================================= short test summary info ==========================================================================
SKIPPED [1] setuptools/tests/test_msvc.py:17: could not import 'distutils.msvc9compiler': No module named 'winreg'
ERROR setuptools/tests/test_bdist_egg.py
ERROR setuptools/tests/test_build_ext.py
ERROR setuptools/tests/test_build_meta.py
ERROR setuptools/tests/test_config.py
ERROR setuptools/tests/test_depends.py
ERROR setuptools/tests/test_develop.py
ERROR setuptools/tests/test_dist.py
ERROR setuptools/tests/test_dist_info.py
ERROR setuptools/tests/test_easy_install.py
ERROR setuptools/tests/test_egg_info.py
ERROR setuptools/tests/test_install_scripts.py
ERROR setuptools/tests/test_msvc.py
ERROR setuptools/tests/test_namespaces.py
ERROR setuptools/tests/test_packageindex.py
ERROR setuptools/tests/test_sdist.py
ERROR setuptools/tests/test_test.py
ERROR setuptools/tests/test_upload_docs.py
ERROR setuptools/tests/test_virtualenv.py
ERROR setuptools/tests/test_wheel.py
ERROR setuptools/tests/integration/test_pip_install_sdist.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 20 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
====================================================================== 1 skipped, 20 errors in 2.82s =======================================================================
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logs seem very different for me 😄, looks like you are making progress!
Can you confirm that you are using the exact same flags used in setuptools own tox.ini
file and /or .github/workflows/main.yml
?
Can you also confirm that you are running pytest from a directory with all the configuration files present in the repository (pyproject.toml
, pytest.ini
, setup.cfg
, conftest.py
)?
Uodate: dropping |
If PY_IGNORE_IMPORTMISMATCH=1 is kind of solution IMO probably that env variable embed in pytest.ini (but I'm not sure is that cures only my scenario of testing or is it something which could be used by default) + pytest -ra -p no:randomly setuptools -W ignore::DeprecationWarning
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/setuptools-60.5.4, configfile: pytest.ini
plugins: shutil-1.7.0, forked-1.4.0, cov-3.0.0, virtualenv-1.7.0, checkdocs-2.7.1, flake8-1.0.7, xdist-2.5.0
collected 597 items / 2 skipped / 595 selected
setuptools/dist.py . [ 0%]
setuptools/namespaces.py . [ 0%]
setuptools/package_index.py .. [ 0%]
setuptools/sandbox.py . [ 0%]
setuptools/command/develop.py . [ 1%]
setuptools/command/install_lib.py . [ 1%]
setuptools/tests/test_archive_util.py X [ 1%]
setuptools/tests/test_bdist_deprecations.py . [ 1%]
setuptools/tests/test_bdist_egg.py .x [ 1%]
setuptools/tests/test_build_clib.py F [ 2%]
setuptools/tests/test_build_ext.py FFF. [ 2%]
setuptools/tests/test_build_meta.py ................................................................................................................................ [ 24%]
...... [ 25%]
setuptools/tests/test_build_py.py ... [ 25%]
setuptools/tests/test_config.py ............................................F [ 33%]
setuptools/tests/test_dep_util.py . [ 33%]
setuptools/tests/test_depends.py . [ 33%]
setuptools/tests/test_develop.py s....F [ 34%]
setuptools/tests/test_dist.py ..FFFFFxFFFxFFFFFFFFFFFFFFF.....F..... [ 40%]
setuptools/tests/test_dist_info.py .. [ 41%]
setuptools/tests/test_distutils_adoption.py EEEE. [ 42%]
setuptools/tests/test_easy_install.py .FF..FFF...........F............F.F.............. [ 50%]
setuptools/tests/test_egg_info.py .........................x............................................... [ 62%]
setuptools/tests/test_extern.py ..F [ 62%]
setuptools/tests/test_find_packages.py ............ [ 64%]
setuptools/tests/test_glob.py .... [ 65%]
setuptools/tests/test_install_scripts.py .s.s [ 66%]
setuptools/tests/test_integration.py sssss [ 67%]
setuptools/tests/test_manifest.py ................................................................... [ 78%]
setuptools/tests/test_msvc14.py ssss [ 79%]
setuptools/tests/test_namespaces.py ...E [ 79%]
setuptools/tests/test_packageindex.py ....F............... [ 83%]
setuptools/tests/test_register.py F [ 83%]
setuptools/tests/test_sandbox.py .......... [ 84%]
setuptools/tests/test_sdist.py ................. [ 87%]
setuptools/tests/test_setopt.py .. [ 88%]
setuptools/tests/test_setuptools.py ...................... [ 91%]
setuptools/tests/test_sphinx_upload_docs.py . [ 91%]
setuptools/tests/test_test.py . [ 92%]
setuptools/tests/test_unicode_utils.py . [ 92%]
setuptools/tests/test_upload.py F [ 92%]
setuptools/tests/test_upload_docs.py .. [ 92%]
setuptools/tests/test_virtualenv.py EExEEExEE [ 94%]
setuptools/tests/test_wheel.py .....FFFFFFFFFFFFFFFF.. [ 98%]
setuptools/tests/test_windows_wrappers.py sss [ 98%]
setuptools/tests/integration/test_pip_install_sdist.py ssssssss [100%]
================================================================================== ERRORS ==================================================================================
[..]
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
/home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
listing git files failed - pretending there aren't any
========================================================================= short test summary info ==========================================================================
SKIPPED [2] setuptools/tests/test_msvc.py:17: could not import 'distutils.msvc9compiler': No module named 'winreg'
SKIPPED [1] setuptools/tests/test_develop.py:66: TODO: needs a fixture to cause 'develop' to be invoked without mutating environment.
SKIPPED [1] setuptools/tests/test_install_scripts.py:50: Windows only
SKIPPED [1] setuptools/tests/test_install_scripts.py:78: Windows only
SKIPPED [5] setuptools/tests/test_integration.py:31: Integration tests cannot run when pbr is installed
SKIPPED [1] setuptools/tests/test_msvc14.py:16: These tests are only for win32
SKIPPED [1] setuptools/tests/test_msvc14.py:34: These tests are only for win32
SKIPPED [1] setuptools/tests/test_msvc14.py:52: These tests are only for win32
SKIPPED [1] setuptools/tests/test_msvc14.py:68: These tests are only for win32
SKIPPED [1] setuptools/tests/test_windows_wrappers.py:80: Windows only
SKIPPED [1] setuptools/tests/test_windows_wrappers.py:121: Windows only
SKIPPED [1] setuptools/tests/test_windows_wrappers.py:180: Windows only
SKIPPED [8] conftest.py:68: skipping integration tests
XFAIL setuptools/tests/test_bdist_egg.py::Test::test_exclude_source_files
Byte code disabled
XFAIL setuptools/tests/test_dist.py::test_read_metadata[Metadata Version 1.2: Project-Url-attrs5]
Issue #1578: project_urls not read
XFAIL setuptools/tests/test_dist.py::test_read_metadata[Metadata Version 2.1: Provides Extra-attrs9]
provides_extras not read
XFAIL setuptools/tests/test_egg_info.py::TestEggInfo::test_requires[extras_require_with_marker_in_setup_cfg]
XFAIL setuptools/tests/test_virtualenv.py::test_pip_upgrade_from_source[pip<20]
pypa/pip#6599
XFAIL setuptools/tests/test_virtualenv.py::test_pip_upgrade_from_source[https://github.com/pypa/pip/archive/main.zip]
#2975
XPASS setuptools/tests/test_archive_util.py::test_unicode_files #710 and #712
ERROR setuptools/tests/test_distutils_adoption.py::test_distutils_stdlib - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'virtualenv', Path('/tmp/py...
ERROR setuptools/tests/test_distutils_adoption.py::test_distutils_local_with_setuptools - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'virtualenv'...
ERROR setuptools/tests/test_distutils_adoption.py::test_distutils_local - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'virtualenv', Path('/tmp/pyt...
ERROR setuptools/tests/test_distutils_adoption.py::test_pip_import - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'virtualenv', Path('/tmp/pytest-o...
ERROR setuptools/tests/test_namespaces.py::TestNamespaces::test_packages_in_the_same_namespace_installed_and_cwd - subprocess.CalledProcessError: Command '['/usr/bin/pyt...
ERROR setuptools/tests/test_virtualenv.py::test_clean_env_install - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'virtualenv', Path('/tmp/pytest-of...
ERROR setuptools/tests/test_virtualenv.py::test_pip_upgrade_from_source[None] - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'virtualenv', Path('/t...
ERROR setuptools/tests/test_virtualenv.py::test_pip_upgrade_from_source[pip<20.1] - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'virtualenv', Path...
ERROR setuptools/tests/test_virtualenv.py::test_pip_upgrade_from_source[pip<21] - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'virtualenv', Path('...
ERROR setuptools/tests/test_virtualenv.py::test_pip_upgrade_from_source[pip<22] - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'virtualenv', Path('...
ERROR setuptools/tests/test_virtualenv.py::test_test_command_install_requirements - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'virtualenv', Path...
ERROR setuptools/tests/test_virtualenv.py::test_no_missing_dependencies - subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'virtualenv', Path('/tmp/pyt...
FAILED setuptools/tests/test_build_clib.py::TestBuildCLib::test_build_libraries - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BU...
FAILED setuptools/tests/test_build_ext.py::TestBuildExt::test_get_ext_filename - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUI...
FAILED setuptools/tests/test_build_ext.py::TestBuildExt::test_abi3_filename - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/...
FAILED setuptools/tests/test_build_ext.py::TestBuildExt::test_ext_suffix_override - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/...
FAILED setuptools/tests/test_config.py::TestExternalSetters::test_external_setters - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild...
FAILED setuptools/tests/test_develop.py::TestNamespaces::test_editable_prefix - subprocess.CalledProcessError: Command '[PosixPath('/tmp/pytest-of-tkloczko/pytest-50/tes...
FAILED setuptools/tests/test_dist.py::test_read_metadata[Metadata version 1.0-attrs0] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbu...
FAILED setuptools/tests/test_dist.py::test_read_metadata[Metadata Version 1.0: Short long description-attrs1] - LookupError: setuptools-scm was unable to detect version ...
FAILED setuptools/tests/test_dist.py::test_read_metadata[Metadata version 1.1: Classifiers-attrs2] - LookupError: setuptools-scm was unable to detect version for /home/t...
FAILED setuptools/tests/test_dist.py::test_read_metadata[Metadata version 1.1: Download URL-attrs3] - LookupError: setuptools-scm was unable to detect version for /home/...
FAILED setuptools/tests/test_dist.py::test_read_metadata[Metadata Version 1.2: Requires-Python-attrs4] - LookupError: setuptools-scm was unable to detect version for /ho...
FAILED setuptools/tests/test_dist.py::test_read_metadata[Metadata Version 2.1: Long Description Content Type-attrs6] - LookupError: setuptools-scm was unable to detect v...
FAILED setuptools/tests/test_dist.py::test_read_metadata[License-attrs7] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/set...
FAILED setuptools/tests/test_dist.py::test_read_metadata[License multiline-attrs8] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild...
FAILED setuptools/tests/test_dist.py::test_read_metadata[Missing author-attrs10] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/B...
FAILED setuptools/tests/test_dist.py::test_read_metadata[Missing author e-mail-attrs11] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpm...
FAILED setuptools/tests/test_dist.py::test_read_metadata[Missing author and e-mail-attrs12] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko...
FAILED setuptools/tests/test_dist.py::test_read_metadata[Bypass normalized version-attrs13] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko...
FAILED setuptools/tests/test_dist.py::test_maintainer_author[No author, no maintainer-attrs0] - LookupError: setuptools-scm was unable to detect version for /home/tklocz...
FAILED setuptools/tests/test_dist.py::test_maintainer_author[Author (no e-mail), no maintainer-attrs1] - LookupError: setuptools-scm was unable to detect version for /ho...
FAILED setuptools/tests/test_dist.py::test_maintainer_author[Author (e-mail), no maintainer-attrs2] - LookupError: setuptools-scm was unable to detect version for /home/...
FAILED setuptools/tests/test_dist.py::test_maintainer_author[No author, maintainer (no e-mail)-attrs3] - LookupError: setuptools-scm was unable to detect version for /ho...
FAILED setuptools/tests/test_dist.py::test_maintainer_author[No author, maintainer (e-mail)-attrs4] - LookupError: setuptools-scm was unable to detect version for /home/...
FAILED setuptools/tests/test_dist.py::test_maintainer_author[Author (no e-mail), Maintainer (no-email)-attrs5] - LookupError: setuptools-scm was unable to detect version...
FAILED setuptools/tests/test_dist.py::test_maintainer_author[Author (e-mail), Maintainer (e-mail)-attrs6] - LookupError: setuptools-scm was unable to detect version for ...
FAILED setuptools/tests/test_dist.py::test_maintainer_author[No author (e-mail), no maintainer (e-mail)-attrs7] - LookupError: setuptools-scm was unable to detect versio...
FAILED setuptools/tests/test_dist.py::test_maintainer_author[Author unicode-attrs8] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuil...
FAILED setuptools/tests/test_dist.py::test_maintainer_author[Maintainer unicode-attrs9] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpm...
FAILED setuptools/tests/test_dist.py::test_provides_extras_deterministic_order - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUI...
FAILED setuptools/tests/test_dist.py::test_check_specifier - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/setuptools-60.5.4.
FAILED setuptools/tests/test_easy_install.py::TestEasyInstallTest::test_no_find_links - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbu...
FAILED setuptools/tests/test_easy_install.py::TestEasyInstallTest::test_write_exception - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpm...
FAILED setuptools/tests/test_easy_install.py::TestEasyInstallTest::test_unicode_filename_in_sdist - LookupError: setuptools-scm was unable to detect version for /home/tk...
FAILED setuptools/tests/test_easy_install.py::TestEasyInstallTest::test_unicode_content_in_sdist - LookupError: setuptools-scm was unable to detect version for /home/tkl...
FAILED setuptools/tests/test_easy_install.py::TestEasyInstallTest::test_script_install - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmb...
FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_honors_fetch_params - AssertionError: assert [] == ['/does-not-exist/']
FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_honors_pip_env - distutils.errors.DistutilsError: Command '['/usr/bin/python3', '-m'...
FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_with_allow_hosts - distutils.errors.DistutilsError: the `allow-hosts` option is not ...
FAILED setuptools/tests/test_extern.py::test_distribution_picklable - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/setuptoo...
FAILED setuptools/tests/test_packageindex.py::TestPackageIndex::test_bad_url_double_scheme - distutils.errors.DistutilsError: http://http://svn.pythonpaste.org/Paste/wph...
FAILED setuptools/tests/test_register.py::TestRegister::test_register_exception - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BU...
FAILED setuptools/tests/test_upload.py::TestUpload::test_upload_exception - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/se...
FAILED setuptools/tests/test_wheel.py::test_wheel_install[basic] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/setuptools-...
FAILED setuptools/tests/test_wheel.py::test_wheel_install[utf-8] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/setuptools-...
FAILED setuptools/tests/test_wheel.py::test_wheel_install[data] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/setuptools-6...
FAILED setuptools/tests/test_wheel.py::test_wheel_install[extension] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/setupto...
FAILED setuptools/tests/test_wheel.py::test_wheel_install[header] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/setuptools...
FAILED setuptools/tests/test_wheel.py::test_wheel_install[script] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/setuptools...
FAILED setuptools/tests/test_wheel.py::test_wheel_install[requires1] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/setupto...
FAILED setuptools/tests/test_wheel.py::test_wheel_install[requires2] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/setupto...
FAILED setuptools/tests/test_wheel.py::test_wheel_install[requires3] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/setupto...
FAILED setuptools/tests/test_wheel.py::test_wheel_install[requires4] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/setupto...
FAILED setuptools/tests/test_wheel.py::test_wheel_install[requires5] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/setupto...
FAILED setuptools/tests/test_wheel.py::test_wheel_install[requires_ensure_order] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/B...
FAILED setuptools/tests/test_wheel.py::test_wheel_install[namespace_package] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD...
FAILED setuptools/tests/test_wheel.py::test_wheel_install[empty_namespace_package] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild...
FAILED setuptools/tests/test_wheel.py::test_wheel_install[data_in_package] - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/s...
FAILED setuptools/tests/test_wheel.py::test_wheel_install_pep_503 - LookupError: setuptools-scm was unable to detect version for /home/tkloczko/rpmbuild/BUILD/setuptools...
========================================= 58 failed, 497 passed, 25 skipped, 6 xfailed, 1 xpassed, 12 errors in 121.82s (0:02:01) ========================================== All errors about Please let me know if you want full pytest output because its size is +64KB and cannot be c&p here as comment. |
What can I say, it is really hard to make the tests pass if they are running in a way they were not designed to run... |
I made just experiment with remove special version %pytest rpm macro to use its standard form which I'm using with +670 other modules in which I'm injecting + PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -p no:randomly setuptools -W ignore::DeprecationWarning
=========================================================================== test session starts ============================================================================
platform linux -- Python 3.8.12, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/setuptools-60.5.4, configfile: pytest.ini
plugins: shutil-1.7.0, forked-1.4.0, cov-3.0.0, virtualenv-1.7.0, checkdocs-2.7.1, flake8-1.0.7, xdist-2.5.0
collected 597 items / 2 skipped / 595 selected
setuptools/dist.py . [ 0%]
setuptools/namespaces.py . [ 0%]
setuptools/package_index.py .. [ 0%]
setuptools/sandbox.py . [ 0%]
setuptools/command/develop.py . [ 1%]
setuptools/command/install_lib.py . [ 1%]
setuptools/tests/test_archive_util.py X [ 1%]
setuptools/tests/test_bdist_deprecations.py . [ 1%]
setuptools/tests/test_bdist_egg.py .x [ 1%]
setuptools/tests/test_build_clib.py . [ 2%]
setuptools/tests/test_build_ext.py .... [ 2%]
setuptools/tests/test_build_meta.py ................................................................................................................................ [ 24%]
...... [ 25%]
setuptools/tests/test_build_py.py ... [ 25%]
setuptools/tests/test_config.py ............................................. [ 33%]
setuptools/tests/test_dep_util.py . [ 33%]
setuptools/tests/test_depends.py . [ 33%]
setuptools/tests/test_develop.py s....F [ 34%]
setuptools/tests/test_dist.py .......x...x.......................... [ 40%]
setuptools/tests/test_dist_info.py .. [ 41%]
setuptools/tests/test_distutils_adoption.py ..... [ 42%]
setuptools/tests/test_easy_install.py ..F.............................F.F.............. [ 50%]
setuptools/tests/test_egg_info.py .........................x............................................... [ 62%]
setuptools/tests/test_extern.py ... [ 62%]
setuptools/tests/test_find_packages.py ............ [ 64%]
setuptools/tests/test_glob.py .... [ 65%]
setuptools/tests/test_install_scripts.py .s.s [ 66%]
setuptools/tests/test_integration.py sssss [ 67%]
setuptools/tests/test_manifest.py ................................................................... [ 78%]
setuptools/tests/test_msvc14.py ssss [ 79%]
setuptools/tests/test_namespaces.py .... [ 79%]
setuptools/tests/test_packageindex.py ....F............... [ 83%]
setuptools/tests/test_register.py . [ 83%]
setuptools/tests/test_sandbox.py .......... [ 84%]
setuptools/tests/test_sdist.py ................. [ 87%]
setuptools/tests/test_setopt.py .. [ 88%]
setuptools/tests/test_setuptools.py ...................... [ 91%]
setuptools/tests/test_sphinx_upload_docs.py . [ 91%]
setuptools/tests/test_test.py . [ 92%]
setuptools/tests/test_unicode_utils.py . [ 92%]
setuptools/tests/test_upload.py . [ 92%]
setuptools/tests/test_upload_docs.py .. [ 92%]
setuptools/tests/test_virtualenv.py .FxFFFx.. [ 94%]
setuptools/tests/test_wheel.py ....................... [ 98%]
setuptools/tests/test_windows_wrappers.py sss [ 98%]
setuptools/tests/integration/test_pip_install_sdist.py ssssssss [100%]
================================================================================= FAILURES =================================================================================
___________________________________________________________________ TestNamespaces.test_editable_prefix ____________________________________________________________________
self = <setuptools.tests.test_develop.TestNamespaces object at 0x7f316d42eb50>, tmp_path = PosixPath('/tmp/pytest-of-tkloczko/pytest-51/test_editable_prefix0')
sample_project = PosixPath('/tmp/pytest-of-tkloczko/pytest-51/test_editable_prefix0/sampleproject')
@pytest.mark.xfail(
platform.python_implementation() == 'PyPy',
reason="Workaround fails on PyPy (why?)",
)
def test_editable_prefix(self, tmp_path, sample_project):
"""
Editable install to a prefix should be discoverable.
"""
prefix = tmp_path / 'prefix'
prefix.mkdir()
# figure out where pip will likely install the package
site_packages = prefix / next(
pathlib.Path(path).relative_to(sys.prefix)
for path in sys.path
if 'site-packages' in path and path.startswith(sys.prefix)
)
# install the workaround
self.install_workaround(site_packages)
env = dict(os.environ, PYTHONPATH=str(site_packages))
cmd = [
sys.executable,
'-m',
'pip',
'install',
'--editable',
str(sample_project),
'--prefix',
str(prefix),
'--no-build-isolation',
]
subprocess.check_call(cmd, env=env)
# now run 'sample' with the prefix on the PYTHONPATH
bin = 'Scripts' if platform.system() == 'Windows' else 'bin'
exe = prefix / bin / 'sample'
if sys.version_info < (3, 8) and platform.system() == 'Windows':
exe = str(exe)
> subprocess.check_call([exe], env=env)
setuptools/tests/test_develop.py:224:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
popenargs = ([PosixPath('/tmp/pytest-of-tkloczko/pytest-51/test_editable_prefix0/prefix/bin/sample')],)
kwargs = {'env': {'AR': '/usr/bin/gcc-ar', 'BASH_FUNC_which%%': '() { ( alias;\n eval ${which_declare} ) | /usr/bin/which --tt...es -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none', ...}}
retcode = 1, cmd = [PosixPath('/tmp/pytest-of-tkloczko/pytest-51/test_editable_prefix0/prefix/bin/sample')]
def check_call(*popenargs, **kwargs):
"""Run command with arguments. Wait for command to complete. If
the exit code was zero then return, otherwise raise
CalledProcessError. The CalledProcessError object will have the
return code in the returncode attribute.
The arguments are the same as for the call function. Example:
check_call(["ls", "-l"])
"""
retcode = call(*popenargs, **kwargs)
if retcode:
cmd = kwargs.get("args")
if cmd is None:
cmd = popenargs[0]
> raise CalledProcessError(retcode, cmd)
E subprocess.CalledProcessError: Command '[PosixPath('/tmp/pytest-of-tkloczko/pytest-51/test_editable_prefix0/prefix/bin/sample')]' returned non-zero exit status 1.
/usr/lib64/python3.8/subprocess.py:364: CalledProcessError
-------------------------------------------------------------------------- Captured stderr setup ---------------------------------------------------------------------------
Cloning into 'sampleproject'...
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
Obtaining file:///tmp/pytest-of-tkloczko/pytest-51/test_editable_prefix0/sampleproject
Checking if build backend supports build_editable: started
Checking if build backend supports build_editable: finished with status 'done'
Preparing metadata (pyproject.toml): started
Preparing metadata (pyproject.toml): finished with status 'done'
Collecting peppercorn
Using cached peppercorn-0.6-py3-none-any.whl (4.8 kB)
Installing collected packages: peppercorn, sampleproject
Running setup.py develop for sampleproject
Successfully installed peppercorn-0.6 sampleproject-2.0.0
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
Traceback (most recent call last):
File "/tmp/pytest-of-tkloczko/pytest-51/test_editable_prefix0/prefix/bin/sample", line 33, in <module>
sys.exit(load_entry_point('sampleproject', 'console_scripts', 'sample')())
File "/tmp/pytest-of-tkloczko/pytest-51/test_editable_prefix0/prefix/bin/sample", line 22, in importlib_load_entry_point
for entry_point in distribution(dist_name).entry_points
File "/usr/lib64/python3.8/importlib/metadata.py", line 503, in distribution
return Distribution.from_name(distribution_name)
File "/usr/lib64/python3.8/importlib/metadata.py", line 177, in from_name
raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: sampleproject
_________________________________________________________________ TestEasyInstallTest.test_write_exception _________________________________________________________________
self = <setuptools.tests.test_easy_install.TestEasyInstallTest object at 0x7f316d226e20>
def test_write_exception(self):
"""
Test that `cant_write_to_target` is rendered as a DistutilsError.
"""
dist = Distribution()
cmd = ei.easy_install(dist)
cmd.install_dir = os.getcwd()
with pytest.raises(distutils.errors.DistutilsError):
> cmd.cant_write_to_target()
setuptools/tests/test_easy_install.py:115:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <setuptools.command.easy_install.easy_install object at 0x7f316d325100>
def cant_write_to_target(self):
msg = self.__cant_write_msg % (sys.exc_info()[1], self.install_dir,)
if not os.path.exists(self.install_dir):
msg += '\n' + self.__not_exists_id
else:
msg += '\n' + self.__access_msg
> raise DistutilsError(msg)
E distutils.errors.DistutilsError: can't create or remove files in install directory
E
E The following error occurred while trying to add or remove files in the
E installation directory:
E
E None
E
E The installation directory you specified (via --install-dir, --prefix, or
E the distutils default setting) was:
E
E /home/tkloczko/rpmbuild/BUILD/setuptools-60.5.4
E
E Perhaps your account does not have write access to this directory? If the
E installation directory is a system-owned directory, you may need to sign in
E as the administrator or "root" account. If you do not have administrative
E access to this machine, you may wish to choose a different installation
E directory, preferably one that is listed in your PYTHONPATH environment
E variable.
E
E For information on other options, you may wish to consult the
E documentation at:
E
E https://setuptools.pypa.io/en/latest/deprecated/easy_install.html
E
E Please make the appropriate changes for your system and try again.
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/command/easy_install.py:541: DistutilsError
___________________________________________________________ TestSetupRequires.test_setup_requires_honors_pip_env ___________________________________________________________
dist = <setuptools._install_setup_requires.<locals>.MinimalDistribution object at 0x7f315f419880>, req = Requirement.parse('python-xlib==0.19')
def fetch_build_egg(dist, req): # noqa: C901 # is too complex (16) # FIXME
"""Fetch an egg needed for building.
Use pip/wheel to fetch/build a wheel."""
warnings.warn(
"setuptools.installer is deprecated. Requirements should "
"be satisfied by a PEP 517 installer.",
SetuptoolsDeprecationWarning,
)
# Warn if wheel is not available
try:
pkg_resources.get_distribution('wheel')
except pkg_resources.DistributionNotFound:
dist.announce('WARNING: The wheel package is not available.', log.WARN)
# Ignore environment markers; if supplied, it is required.
req = strip_marker(req)
# Take easy_install options into account, but do not override relevant
# pip environment variables (like PIP_INDEX_URL or PIP_QUIET); they'll
# take precedence.
opts = dist.get_option_dict('easy_install')
if 'allow_hosts' in opts:
raise DistutilsError('the `allow-hosts` option is not supported '
'when using pip to install requirements.')
quiet = 'PIP_QUIET' not in os.environ and 'PIP_VERBOSE' not in os.environ
if 'PIP_INDEX_URL' in os.environ:
index_url = None
elif 'index_url' in opts:
index_url = opts['index_url'][1]
else:
index_url = None
find_links = (
_fixup_find_links(opts['find_links'][1])[:] if 'find_links' in opts
else []
)
if dist.dependency_links:
find_links.extend(dist.dependency_links)
eggs_dir = os.path.realpath(dist.get_egg_cache_dir())
environment = pkg_resources.Environment()
for egg_dist in pkg_resources.find_distributions(eggs_dir):
if egg_dist in req and environment.can_add(egg_dist):
return egg_dist
with tempfile.TemporaryDirectory() as tmpdir:
cmd = [
sys.executable, '-m', 'pip',
'--disable-pip-version-check',
'wheel', '--no-deps',
'-w', tmpdir,
]
if quiet:
cmd.append('--quiet')
if index_url is not None:
cmd.extend(('--index-url', index_url))
for link in find_links or []:
cmd.extend(('--find-links', link))
# If requirement is a PEP 508 direct URL, directly pass
# the URL to pip, as `req @ url` does not work on the
# command line.
cmd.append(req.url or str(req))
try:
> subprocess.check_call(cmd)
setuptools/installer.py:82:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
popenargs = (['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', ...],), kwargs = {}, retcode = 1
cmd = ['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', ...]
def check_call(*popenargs, **kwargs):
"""Run command with arguments. Wait for command to complete. If
the exit code was zero then return, otherwise raise
CalledProcessError. The CalledProcessError object will have the
return code in the returncode attribute.
The arguments are the same as for the call function. Example:
check_call(["ls", "-l"])
"""
retcode = call(*popenargs, **kwargs)
if retcode:
cmd = kwargs.get("args")
if cmd is None:
cmd = popenargs[0]
> raise CalledProcessError(retcode, cmd)
E subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpbjtjlz55/test_pkg/temp/tmpui44qxu7', '--quiet', 'python-xlib==0.19']' returned non-zero exit status 1.
/usr/lib64/python3.8/subprocess.py:364: CalledProcessError
The above exception was the direct cause of the following exception:
@contextlib.contextmanager
def save_modules():
"""
Context in which imported modules are saved.
Translates exceptions internal to the context into the equivalent exception
outside the context.
"""
saved = sys.modules.copy()
with ExceptionSaver() as saved_exc:
> yield saved
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:156:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
setup_dir = '/tmp/tmpbjtjlz55/test_pkg'
@contextlib.contextmanager
def setup_context(setup_dir):
temp_dir = os.path.join(setup_dir, 'temp')
with save_pkg_resources_state():
with save_modules():
with save_path():
hide_setuptools()
with save_argv():
with override_temp(temp_dir):
with pushd(setup_dir):
# ensure setuptools commands are available
__import__('setuptools')
> yield
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:198:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
setup_script = '/tmp/tmpbjtjlz55/test_pkg/setup.py', args = ['--version']
def run_setup(setup_script, args):
"""Run a distutils setup script, sandboxed in its directory"""
setup_dir = os.path.abspath(os.path.dirname(setup_script))
with setup_context(setup_dir):
try:
sys.argv[:] = [setup_script] + list(args)
sys.path.insert(0, setup_dir)
# reset to include setup dir, w/clean callback list
working_set.__init__()
working_set.callbacks.append(lambda dist: dist.activate())
with DirectorySandbox(setup_dir):
ns = dict(__file__=setup_script, __name__='__main__')
> _execfile(setup_script, ns)
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:259:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
filename = '/tmp/tmpbjtjlz55/test_pkg/setup.py'
globals = {'__builtins__': {'ArithmeticError': <class 'ArithmeticError'>, 'AssertionError': <class 'AssertionError'>, 'Attribute...__', 'setuptools': <module 'setuptools' from '/home/tkloczko/rpmbuild/BUILD/setuptools-60.5.4/setuptools/__init__.py'>}
locals = {'__builtins__': {'ArithmeticError': <class 'ArithmeticError'>, 'AssertionError': <class 'AssertionError'>, 'Attribute...__', 'setuptools': <module 'setuptools' from '/home/tkloczko/rpmbuild/BUILD/setuptools-60.5.4/setuptools/__init__.py'>}
def _execfile(filename, globals, locals=None):
"""
Python 3 implementation of execfile.
"""
mode = 'rb'
with open(filename, mode) as stream:
script = stream.read()
if locals is None:
locals = globals
code = compile(script, filename, 'exec')
> exec(code, globals, locals)
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:46:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
/tmp/tmpbjtjlz55/test_pkg/setup.py:2:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attrs = {'dependency_links': [], 'name': 'test_pkg', 'setup_requires': ['python-xlib==0.19'], 'version': '0.0'}
def setup(**attrs):
# Make sure we have any requirements needed to interpret 'attrs'.
logging.configure()
> _install_setup_requires(attrs)
setuptools/__init__.py:154:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attrs = {'dependency_links': [], 'name': 'test_pkg', 'setup_requires': ['python-xlib==0.19'], 'version': '0.0'}
def _install_setup_requires(attrs):
# Note: do not use `setuptools.Distribution` directly, as
# our PEP 517 backend patch `distutils.core.Distribution`.
class MinimalDistribution(distutils.core.Distribution):
"""
A minimal version of a distribution for supporting the
fetch_build_eggs interface.
"""
def __init__(self, attrs):
_incl = 'dependency_links', 'setup_requires'
filtered = {k: attrs[k] for k in set(_incl) & set(attrs)}
distutils.core.Distribution.__init__(self, filtered)
def finalize_options(self):
"""
Disable finalize_options to avoid building the working set.
Ref #2158.
"""
dist = MinimalDistribution(attrs)
# Honor setup.cfg's options.
dist.parse_config_files(ignore_option_errors=True)
if dist.setup_requires:
> dist.fetch_build_eggs(dist.setup_requires)
setuptools/__init__.py:148:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <setuptools._install_setup_requires.<locals>.MinimalDistribution object at 0x7f315f419880>, requires = ['python-xlib==0.19']
def fetch_build_eggs(self, requires):
"""Resolve pre-setup requirements"""
> resolved_dists = pkg_resources.working_set.resolve(
pkg_resources.parse_requirements(requires),
installer=self.fetch_build_egg,
replace_conflicting=True,
)
setuptools/dist.py:812:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pkg_resources.WorkingSet object at 0x7f315f514ca0>, requirements = [], env = <pkg_resources.Environment object at 0x7f315f52fee0>
installer = <bound method Distribution.fetch_build_egg of <setuptools._install_setup_requires.<locals>.MinimalDistribution object at 0x7f315f419880>>
replace_conflicting = True, extras = None
def resolve(self, requirements, env=None, installer=None, # noqa: C901
replace_conflicting=False, extras=None):
"""List all distributions needed to (recursively) meet `requirements`
`requirements` must be a sequence of ``Requirement`` objects. `env`,
if supplied, should be an ``Environment`` instance. If
not supplied, it defaults to all distributions available within any
entry or distribution in the working set. `installer`, if supplied,
will be invoked with each requirement that cannot be met by an
already-installed distribution; it should return a ``Distribution`` or
``None``.
Unless `replace_conflicting=True`, raises a VersionConflict exception
if
any requirements are found on the path that have the correct name but
the wrong version. Otherwise, if an `installer` is supplied it will be
invoked to obtain the correct version of the requirement and activate
it.
`extras` is a list of the extras to be used with these requirements.
This is important because extra requirements may look like `my_req;
extra = "my_extra"`, which would otherwise be interpreted as a purely
optional requirement. Instead, we want to be able to assert that these
requirements are truly required.
"""
# set up the stack
requirements = list(requirements)[::-1]
# set of processed requirements
processed = {}
# key -> dist
best = {}
to_activate = []
req_extras = _ReqExtras()
# Mapping of requirement to set of distributions that required it;
# useful for reporting info about conflicts.
required_by = collections.defaultdict(set)
while requirements:
# process dependencies breadth-first
req = requirements.pop(0)
if req in processed:
# Ignore cyclic or redundant dependencies
continue
if not req_extras.markers_pass(req, extras):
continue
dist = best.get(req.key)
if dist is None:
# Find the best distribution and add it to the map
dist = self.by_key.get(req.key)
if dist is None or (dist not in req and replace_conflicting):
ws = self
if env is None:
if dist is None:
env = Environment(self.entries)
else:
# Use an empty environment and workingset to avoid
# any further conflicts with the conflicting
# distribution
env = Environment([])
ws = WorkingSet([])
> dist = best[req.key] = env.best_match(
req, ws, installer,
replace_conflicting=replace_conflicting
)
pkg_resources/__init__.py:771:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pkg_resources.Environment object at 0x7f315f52fee0>, req = Requirement.parse('python-xlib==0.19'), working_set = <pkg_resources.WorkingSet object at 0x7f315f514ca0>
installer = <bound method Distribution.fetch_build_egg of <setuptools._install_setup_requires.<locals>.MinimalDistribution object at 0x7f315f419880>>
replace_conflicting = True
def best_match(
self, req, working_set, installer=None, replace_conflicting=False):
"""Find distribution best matching `req` and usable on `working_set`
This calls the ``find(req)`` method of the `working_set` to see if a
suitable distribution is already active. (This may raise
``VersionConflict`` if an unsuitable version of the project is already
active in the specified `working_set`.) If a suitable distribution
isn't active, this method returns the newest distribution in the
environment that meets the ``Requirement`` in `req`. If no suitable
distribution is found, and `installer` is supplied, then the result of
calling the environment's ``obtain(req, installer)`` method will be
returned.
"""
try:
dist = working_set.find(req)
except VersionConflict:
if not replace_conflicting:
raise
dist = None
if dist is not None:
return dist
for dist in self[req.key]:
if dist in req:
return dist
# try to download/install
> return self.obtain(req, installer)
pkg_resources/__init__.py:1056:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pkg_resources.Environment object at 0x7f315f52fee0>, requirement = Requirement.parse('python-xlib==0.19')
installer = <bound method Distribution.fetch_build_egg of <setuptools._install_setup_requires.<locals>.MinimalDistribution object at 0x7f315f419880>>
def obtain(self, requirement, installer=None):
"""Obtain a distribution matching `requirement` (e.g. via download)
Obtain a distro that matches requirement (e.g. via download). In the
base ``Environment`` class, this routine just returns
``installer(requirement)``, unless `installer` is None, in which case
None is returned instead. This method is a hook that allows subclasses
to attempt other ways of obtaining a distribution before falling back
to the `installer` argument."""
if installer is not None:
> return installer(requirement)
pkg_resources/__init__.py:1068:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <setuptools._install_setup_requires.<locals>.MinimalDistribution object at 0x7f315f419880>, req = Requirement.parse('python-xlib==0.19')
def fetch_build_egg(self, req):
"""Fetch an egg needed for building"""
from setuptools.installer import fetch_build_egg
> return fetch_build_egg(self, req)
setuptools/dist.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
dist = <setuptools._install_setup_requires.<locals>.MinimalDistribution object at 0x7f315f419880>, req = Requirement.parse('python-xlib==0.19')
def fetch_build_egg(dist, req): # noqa: C901 # is too complex (16) # FIXME
"""Fetch an egg needed for building.
Use pip/wheel to fetch/build a wheel."""
warnings.warn(
"setuptools.installer is deprecated. Requirements should "
"be satisfied by a PEP 517 installer.",
SetuptoolsDeprecationWarning,
)
# Warn if wheel is not available
try:
pkg_resources.get_distribution('wheel')
except pkg_resources.DistributionNotFound:
dist.announce('WARNING: The wheel package is not available.', log.WARN)
# Ignore environment markers; if supplied, it is required.
req = strip_marker(req)
# Take easy_install options into account, but do not override relevant
# pip environment variables (like PIP_INDEX_URL or PIP_QUIET); they'll
# take precedence.
opts = dist.get_option_dict('easy_install')
if 'allow_hosts' in opts:
raise DistutilsError('the `allow-hosts` option is not supported '
'when using pip to install requirements.')
quiet = 'PIP_QUIET' not in os.environ and 'PIP_VERBOSE' not in os.environ
if 'PIP_INDEX_URL' in os.environ:
index_url = None
elif 'index_url' in opts:
index_url = opts['index_url'][1]
else:
index_url = None
find_links = (
_fixup_find_links(opts['find_links'][1])[:] if 'find_links' in opts
else []
)
if dist.dependency_links:
find_links.extend(dist.dependency_links)
eggs_dir = os.path.realpath(dist.get_egg_cache_dir())
environment = pkg_resources.Environment()
for egg_dist in pkg_resources.find_distributions(eggs_dir):
if egg_dist in req and environment.can_add(egg_dist):
return egg_dist
with tempfile.TemporaryDirectory() as tmpdir:
cmd = [
sys.executable, '-m', 'pip',
'--disable-pip-version-check',
'wheel', '--no-deps',
'-w', tmpdir,
]
if quiet:
cmd.append('--quiet')
if index_url is not None:
cmd.extend(('--index-url', index_url))
for link in find_links or []:
cmd.extend(('--find-links', link))
# If requirement is a PEP 508 direct URL, directly pass
# the URL to pip, as `req @ url` does not work on the
# command line.
cmd.append(req.url or str(req))
try:
subprocess.check_call(cmd)
except subprocess.CalledProcessError as e:
> raise DistutilsError(str(e)) from e
E distutils.errors.DistutilsError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpbjtjlz55/test_pkg/temp/tmpui44qxu7', '--quiet', 'python-xlib==0.19']' returned non-zero exit status 1.
setuptools/installer.py:84: DistutilsError
During handling of the above exception, another exception occurred:
self = <setuptools.tests.test_easy_install.TestSetupRequires object at 0x7f315f765130>, mock_index = <MockServer(Thread-2, started daemon 139850281117248)>
monkeypatch = <_pytest.monkeypatch.MonkeyPatch object at 0x7f315f765910>
def test_setup_requires_honors_pip_env(self, mock_index, monkeypatch):
monkeypatch.setenv(str('PIP_RETRIES'), str('0'))
monkeypatch.setenv(str('PIP_TIMEOUT'), str('0'))
monkeypatch.setenv('PIP_NO_INDEX', 'false')
monkeypatch.setenv(str('PIP_INDEX_URL'), mock_index.url)
with contexts.save_pkg_resources_state():
with contexts.tempdir() as temp_dir:
test_pkg = create_setup_requires_package(
temp_dir, 'python-xlib', '0.19',
setup_attrs=dict(dependency_links=[]))
test_setup_cfg = os.path.join(test_pkg, 'setup.cfg')
with open(test_setup_cfg, 'w') as fp:
fp.write(DALS(
'''
[easy_install]
index_url = https://pypi.org/legacy/
'''))
test_setup_py = os.path.join(test_pkg, 'setup.py')
with pytest.raises(distutils.errors.DistutilsError):
> run_setup(test_setup_py, [str('--version')])
setuptools/tests/test_easy_install.py:650:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:262: in run_setup
raise
/usr/lib64/python3.8/contextlib.py:131: in __exit__
self.gen.throw(type, value, traceback)
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:198: in setup_context
yield
/usr/lib64/python3.8/contextlib.py:131: in __exit__
self.gen.throw(type, value, traceback)
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:169: in save_modules
saved_exc.resume()
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:143: in resume
raise exc.with_traceback(self._tb)
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:156: in save_modules
yield saved
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:198: in setup_context
yield
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:259: in run_setup
_execfile(setup_script, ns)
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:46: in _execfile
exec(code, globals, locals)
/tmp/tmpbjtjlz55/test_pkg/setup.py:2: in <module>
???
setuptools/__init__.py:154: in setup
_install_setup_requires(attrs)
setuptools/__init__.py:148: in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
setuptools/dist.py:812: in fetch_build_eggs
resolved_dists = pkg_resources.working_set.resolve(
pkg_resources/__init__.py:771: in resolve
dist = best[req.key] = env.best_match(
pkg_resources/__init__.py:1056: in best_match
return self.obtain(req, installer)
pkg_resources/__init__.py:1068: in obtain
return installer(requirement)
setuptools/dist.py:883: in fetch_build_egg
return fetch_build_egg(self, req)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
dist = <setuptools._install_setup_requires.<locals>.MinimalDistribution object at 0x7f315f419880>, req = Requirement.parse('python-xlib==0.19')
def fetch_build_egg(dist, req): # noqa: C901 # is too complex (16) # FIXME
"""Fetch an egg needed for building.
Use pip/wheel to fetch/build a wheel."""
warnings.warn(
"setuptools.installer is deprecated. Requirements should "
"be satisfied by a PEP 517 installer.",
SetuptoolsDeprecationWarning,
)
# Warn if wheel is not available
try:
pkg_resources.get_distribution('wheel')
except pkg_resources.DistributionNotFound:
dist.announce('WARNING: The wheel package is not available.', log.WARN)
# Ignore environment markers; if supplied, it is required.
req = strip_marker(req)
# Take easy_install options into account, but do not override relevant
# pip environment variables (like PIP_INDEX_URL or PIP_QUIET); they'll
# take precedence.
opts = dist.get_option_dict('easy_install')
if 'allow_hosts' in opts:
raise DistutilsError('the `allow-hosts` option is not supported '
'when using pip to install requirements.')
quiet = 'PIP_QUIET' not in os.environ and 'PIP_VERBOSE' not in os.environ
if 'PIP_INDEX_URL' in os.environ:
index_url = None
elif 'index_url' in opts:
index_url = opts['index_url'][1]
else:
index_url = None
find_links = (
_fixup_find_links(opts['find_links'][1])[:] if 'find_links' in opts
else []
)
if dist.dependency_links:
find_links.extend(dist.dependency_links)
eggs_dir = os.path.realpath(dist.get_egg_cache_dir())
environment = pkg_resources.Environment()
for egg_dist in pkg_resources.find_distributions(eggs_dir):
if egg_dist in req and environment.can_add(egg_dist):
return egg_dist
with tempfile.TemporaryDirectory() as tmpdir:
cmd = [
sys.executable, '-m', 'pip',
'--disable-pip-version-check',
'wheel', '--no-deps',
'-w', tmpdir,
]
if quiet:
cmd.append('--quiet')
if index_url is not None:
cmd.extend(('--index-url', index_url))
for link in find_links or []:
cmd.extend(('--find-links', link))
# If requirement is a PEP 508 direct URL, directly pass
# the URL to pip, as `req @ url` does not work on the
# command line.
cmd.append(req.url or str(req))
try:
subprocess.check_call(cmd)
except subprocess.CalledProcessError as e:
> raise DistutilsError(str(e)) from e
E distutils.errors.DistutilsError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpbjtjlz55/test_pkg/temp/tmpui44qxu7', '--quiet', 'python-xlib==0.19']' returned non-zero exit status 1.
setuptools/installer.py:84: DistutilsError
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
127.0.0.1 - - [19/Jan/2022 18:05:39] "GET /python-xlib/ HTTP/1.1" 200 -
ERROR: Could not find a version that satisfies the requirement python-xlib==0.19 (from versions: none)
ERROR: No matching distribution found for python-xlib==0.19
__________________________________________________________ TestSetupRequires.test_setup_requires_with_allow_hosts __________________________________________________________
@contextlib.contextmanager
def save_modules():
"""
Context in which imported modules are saved.
Translates exceptions internal to the context into the equivalent exception
outside the context.
"""
saved = sys.modules.copy()
with ExceptionSaver() as saved_exc:
> yield saved
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:156:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
setup_dir = '/tmp/tmpkxfw500q/test_pkg'
@contextlib.contextmanager
def setup_context(setup_dir):
temp_dir = os.path.join(setup_dir, 'temp')
with save_pkg_resources_state():
with save_modules():
with save_path():
hide_setuptools()
with save_argv():
with override_temp(temp_dir):
with pushd(setup_dir):
# ensure setuptools commands are available
__import__('setuptools')
> yield
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:198:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
setup_script = '/tmp/tmpkxfw500q/test_pkg/setup.py', args = ['--version']
def run_setup(setup_script, args):
"""Run a distutils setup script, sandboxed in its directory"""
setup_dir = os.path.abspath(os.path.dirname(setup_script))
with setup_context(setup_dir):
try:
sys.argv[:] = [setup_script] + list(args)
sys.path.insert(0, setup_dir)
# reset to include setup dir, w/clean callback list
working_set.__init__()
working_set.callbacks.append(lambda dist: dist.activate())
with DirectorySandbox(setup_dir):
ns = dict(__file__=setup_script, __name__='__main__')
> _execfile(setup_script, ns)
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:259:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
filename = '/tmp/tmpkxfw500q/test_pkg/setup.py'
globals = {'__builtins__': {'ArithmeticError': <class 'ArithmeticError'>, 'AssertionError': <class 'AssertionError'>, 'Attribute... '__file__': '/tmp/tmpkxfw500q/test_pkg/setup.py', '__name__': '__main__', 'setup': <function setup at 0x7f315f673ee0>}
locals = {'__builtins__': {'ArithmeticError': <class 'ArithmeticError'>, 'AssertionError': <class 'AssertionError'>, 'Attribute... '__file__': '/tmp/tmpkxfw500q/test_pkg/setup.py', '__name__': '__main__', 'setup': <function setup at 0x7f315f673ee0>}
def _execfile(filename, globals, locals=None):
"""
Python 3 implementation of execfile.
"""
mode = 'rb'
with open(filename, mode) as stream:
script = stream.read()
if locals is None:
locals = globals
code = compile(script, filename, 'exec')
> exec(code, globals, locals)
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:46:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ???
/tmp/tmpkxfw500q/test_pkg/setup.py:2:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attrs = {'setup_requires': 'python-xlib'}
def setup(**attrs):
# Make sure we have any requirements needed to interpret 'attrs'.
logging.configure()
> _install_setup_requires(attrs)
setuptools/__init__.py:154:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
attrs = {'setup_requires': 'python-xlib'}
def _install_setup_requires(attrs):
# Note: do not use `setuptools.Distribution` directly, as
# our PEP 517 backend patch `distutils.core.Distribution`.
class MinimalDistribution(distutils.core.Distribution):
"""
A minimal version of a distribution for supporting the
fetch_build_eggs interface.
"""
def __init__(self, attrs):
_incl = 'dependency_links', 'setup_requires'
filtered = {k: attrs[k] for k in set(_incl) & set(attrs)}
distutils.core.Distribution.__init__(self, filtered)
def finalize_options(self):
"""
Disable finalize_options to avoid building the working set.
Ref #2158.
"""
dist = MinimalDistribution(attrs)
# Honor setup.cfg's options.
dist.parse_config_files(ignore_option_errors=True)
if dist.setup_requires:
> dist.fetch_build_eggs(dist.setup_requires)
setuptools/__init__.py:148:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <setuptools._install_setup_requires.<locals>.MinimalDistribution object at 0x7f316ccf8be0>, requires = 'python-xlib'
def fetch_build_eggs(self, requires):
"""Resolve pre-setup requirements"""
> resolved_dists = pkg_resources.working_set.resolve(
pkg_resources.parse_requirements(requires),
installer=self.fetch_build_egg,
replace_conflicting=True,
)
setuptools/dist.py:812:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pkg_resources.WorkingSet object at 0x7f315fcc40a0>, requirements = [], env = <pkg_resources.Environment object at 0x7f315f52fa00>
installer = <bound method Distribution.fetch_build_egg of <setuptools._install_setup_requires.<locals>.MinimalDistribution object at 0x7f316ccf8be0>>
replace_conflicting = True, extras = None
def resolve(self, requirements, env=None, installer=None, # noqa: C901
replace_conflicting=False, extras=None):
"""List all distributions needed to (recursively) meet `requirements`
`requirements` must be a sequence of ``Requirement`` objects. `env`,
if supplied, should be an ``Environment`` instance. If
not supplied, it defaults to all distributions available within any
entry or distribution in the working set. `installer`, if supplied,
will be invoked with each requirement that cannot be met by an
already-installed distribution; it should return a ``Distribution`` or
``None``.
Unless `replace_conflicting=True`, raises a VersionConflict exception
if
any requirements are found on the path that have the correct name but
the wrong version. Otherwise, if an `installer` is supplied it will be
invoked to obtain the correct version of the requirement and activate
it.
`extras` is a list of the extras to be used with these requirements.
This is important because extra requirements may look like `my_req;
extra = "my_extra"`, which would otherwise be interpreted as a purely
optional requirement. Instead, we want to be able to assert that these
requirements are truly required.
"""
# set up the stack
requirements = list(requirements)[::-1]
# set of processed requirements
processed = {}
# key -> dist
best = {}
to_activate = []
req_extras = _ReqExtras()
# Mapping of requirement to set of distributions that required it;
# useful for reporting info about conflicts.
required_by = collections.defaultdict(set)
while requirements:
# process dependencies breadth-first
req = requirements.pop(0)
if req in processed:
# Ignore cyclic or redundant dependencies
continue
if not req_extras.markers_pass(req, extras):
continue
dist = best.get(req.key)
if dist is None:
# Find the best distribution and add it to the map
dist = self.by_key.get(req.key)
if dist is None or (dist not in req and replace_conflicting):
ws = self
if env is None:
if dist is None:
env = Environment(self.entries)
else:
# Use an empty environment and workingset to avoid
# any further conflicts with the conflicting
# distribution
env = Environment([])
ws = WorkingSet([])
> dist = best[req.key] = env.best_match(
req, ws, installer,
replace_conflicting=replace_conflicting
)
pkg_resources/__init__.py:771:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pkg_resources.Environment object at 0x7f315f52fa00>, req = Requirement.parse('python-xlib'), working_set = <pkg_resources.WorkingSet object at 0x7f315fcc40a0>
installer = <bound method Distribution.fetch_build_egg of <setuptools._install_setup_requires.<locals>.MinimalDistribution object at 0x7f316ccf8be0>>
replace_conflicting = True
def best_match(
self, req, working_set, installer=None, replace_conflicting=False):
"""Find distribution best matching `req` and usable on `working_set`
This calls the ``find(req)`` method of the `working_set` to see if a
suitable distribution is already active. (This may raise
``VersionConflict`` if an unsuitable version of the project is already
active in the specified `working_set`.) If a suitable distribution
isn't active, this method returns the newest distribution in the
environment that meets the ``Requirement`` in `req`. If no suitable
distribution is found, and `installer` is supplied, then the result of
calling the environment's ``obtain(req, installer)`` method will be
returned.
"""
try:
dist = working_set.find(req)
except VersionConflict:
if not replace_conflicting:
raise
dist = None
if dist is not None:
return dist
for dist in self[req.key]:
if dist in req:
return dist
# try to download/install
> return self.obtain(req, installer)
pkg_resources/__init__.py:1056:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pkg_resources.Environment object at 0x7f315f52fa00>, requirement = Requirement.parse('python-xlib')
installer = <bound method Distribution.fetch_build_egg of <setuptools._install_setup_requires.<locals>.MinimalDistribution object at 0x7f316ccf8be0>>
def obtain(self, requirement, installer=None):
"""Obtain a distribution matching `requirement` (e.g. via download)
Obtain a distro that matches requirement (e.g. via download). In the
base ``Environment`` class, this routine just returns
``installer(requirement)``, unless `installer` is None, in which case
None is returned instead. This method is a hook that allows subclasses
to attempt other ways of obtaining a distribution before falling back
to the `installer` argument."""
if installer is not None:
> return installer(requirement)
pkg_resources/__init__.py:1068:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <setuptools._install_setup_requires.<locals>.MinimalDistribution object at 0x7f316ccf8be0>, req = Requirement.parse('python-xlib')
def fetch_build_egg(self, req):
"""Fetch an egg needed for building"""
from setuptools.installer import fetch_build_egg
> return fetch_build_egg(self, req)
setuptools/dist.py:883:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
dist = <setuptools._install_setup_requires.<locals>.MinimalDistribution object at 0x7f316ccf8be0>, req = Requirement.parse('python-xlib')
def fetch_build_egg(dist, req): # noqa: C901 # is too complex (16) # FIXME
"""Fetch an egg needed for building.
Use pip/wheel to fetch/build a wheel."""
warnings.warn(
"setuptools.installer is deprecated. Requirements should "
"be satisfied by a PEP 517 installer.",
SetuptoolsDeprecationWarning,
)
# Warn if wheel is not available
try:
pkg_resources.get_distribution('wheel')
except pkg_resources.DistributionNotFound:
dist.announce('WARNING: The wheel package is not available.', log.WARN)
# Ignore environment markers; if supplied, it is required.
req = strip_marker(req)
# Take easy_install options into account, but do not override relevant
# pip environment variables (like PIP_INDEX_URL or PIP_QUIET); they'll
# take precedence.
opts = dist.get_option_dict('easy_install')
if 'allow_hosts' in opts:
> raise DistutilsError('the `allow-hosts` option is not supported '
'when using pip to install requirements.')
E distutils.errors.DistutilsError: the `allow-hosts` option is not supported when using pip to install requirements.
setuptools/installer.py:44: DistutilsError
During handling of the above exception, another exception occurred:
self = <setuptools.tests.test_easy_install.TestSetupRequires object at 0x7f316cac79d0>, mock_index = <MockServer(Thread-4, started daemon 139850023171648)>
def test_setup_requires_with_allow_hosts(self, mock_index):
''' The `allow-hosts` option in not supported anymore. '''
files = {
'test_pkg': {
'setup.py': DALS('''
from setuptools import setup
setup(setup_requires='python-xlib')
'''),
'setup.cfg': DALS('''
[easy_install]
allow_hosts = *
'''),
}
}
with contexts.save_pkg_resources_state():
with contexts.tempdir() as temp_dir:
path.build(files, prefix=temp_dir)
setup_py = str(pathlib.Path(temp_dir, 'test_pkg', 'setup.py'))
with pytest.raises(distutils.errors.DistutilsError):
> run_setup(setup_py, [str('--version')])
setuptools/tests/test_easy_install.py:692:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:262: in run_setup
raise
/usr/lib64/python3.8/contextlib.py:131: in __exit__
self.gen.throw(type, value, traceback)
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:198: in setup_context
yield
/usr/lib64/python3.8/contextlib.py:131: in __exit__
self.gen.throw(type, value, traceback)
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:169: in save_modules
saved_exc.resume()
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:143: in resume
raise exc.with_traceback(self._tb)
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:156: in save_modules
yield saved
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:198: in setup_context
yield
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:259: in run_setup
_execfile(setup_script, ns)
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/sandbox.py:46: in _execfile
exec(code, globals, locals)
/tmp/tmpkxfw500q/test_pkg/setup.py:2: in <module>
???
setuptools/__init__.py:154: in setup
_install_setup_requires(attrs)
setuptools/__init__.py:148: in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
setuptools/dist.py:812: in fetch_build_eggs
resolved_dists = pkg_resources.working_set.resolve(
pkg_resources/__init__.py:771: in resolve
dist = best[req.key] = env.best_match(
pkg_resources/__init__.py:1056: in best_match
return self.obtain(req, installer)
pkg_resources/__init__.py:1068: in obtain
return installer(requirement)
setuptools/dist.py:883: in fetch_build_egg
return fetch_build_egg(self, req)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
dist = <setuptools._install_setup_requires.<locals>.MinimalDistribution object at 0x7f316ccf8be0>, req = Requirement.parse('python-xlib')
def fetch_build_egg(dist, req): # noqa: C901 # is too complex (16) # FIXME
"""Fetch an egg needed for building.
Use pip/wheel to fetch/build a wheel."""
warnings.warn(
"setuptools.installer is deprecated. Requirements should "
"be satisfied by a PEP 517 installer.",
SetuptoolsDeprecationWarning,
)
# Warn if wheel is not available
try:
pkg_resources.get_distribution('wheel')
except pkg_resources.DistributionNotFound:
dist.announce('WARNING: The wheel package is not available.', log.WARN)
# Ignore environment markers; if supplied, it is required.
req = strip_marker(req)
# Take easy_install options into account, but do not override relevant
# pip environment variables (like PIP_INDEX_URL or PIP_QUIET); they'll
# take precedence.
opts = dist.get_option_dict('easy_install')
if 'allow_hosts' in opts:
> raise DistutilsError('the `allow-hosts` option is not supported '
'when using pip to install requirements.')
E distutils.errors.DistutilsError: the `allow-hosts` option is not supported when using pip to install requirements.
setuptools/installer.py:44: DistutilsError
_______________________________________________________________ TestPackageIndex.test_bad_url_double_scheme ________________________________________________________________
self = <setuptools.package_index.PackageIndex object at 0x7f315e5d8b50>, url = 'http://http://svn.pythonpaste.org/Paste/wphp/trunk', warning = None
def open_url(self, url, warning=None): # noqa: C901 # is too complex (12)
if url.startswith('file:'):
return local_open(url)
try:
> return open_with_auth(url, self.opener)
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/package_index.py:757:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
args = ('http://http://svn.pythonpaste.org/Paste/wphp/trunk', <function urlopen at 0x7f316fa5a5e0>), kwargs = {}, old_timeout = None
def _socket_timeout(*args, **kwargs):
old_timeout = socket.getdefaulttimeout()
socket.setdefaulttimeout(timeout)
try:
> return func(*args, **kwargs)
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/package_index.py:952:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
url = 'http://http://svn.pythonpaste.org/Paste/wphp/trunk', opener = <function urlopen at 0x7f316fa5a5e0>
def open_with_auth(url, opener=urllib.request.urlopen):
"""Open a urllib2 request, handling HTTP authentication"""
parsed = urllib.parse.urlparse(url)
scheme, netloc, path, params, query, frag = parsed
# Double scheme does not raise on macOS as revealed by a
# failing test. We would expect "nonnumeric port". Refs #20.
if netloc.endswith(':'):
> raise http.client.InvalidURL("nonnumeric port: ''")
E http.client.InvalidURL: nonnumeric port: ''
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/package_index.py:1046: InvalidURL
The above exception was the direct cause of the following exception:
self = <setuptools.tests.test_packageindex.TestPackageIndex object at 0x7f315e5d89d0>
def test_bad_url_double_scheme(self):
"""
A bad URL with a double scheme should raise a DistutilsError.
"""
index = setuptools.package_index.PackageIndex(
hosts=('www.example.com',)
)
# issue 20
url = 'http://http://svn.pythonpaste.org/Paste/wphp/trunk'
try:
> index.open_url(url)
setuptools/tests/test_packageindex.py:84:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <setuptools.package_index.PackageIndex object at 0x7f315e5d8b50>, url = 'http://http://svn.pythonpaste.org/Paste/wphp/trunk', warning = None
def open_url(self, url, warning=None): # noqa: C901 # is too complex (12)
if url.startswith('file:'):
return local_open(url)
try:
return open_with_auth(url, self.opener)
except (ValueError, http.client.InvalidURL) as v:
msg = ' '.join([str(arg) for arg in v.args])
if warning:
self.warn(warning, msg)
else:
> raise DistutilsError('%s %s' % (url, msg)) from v
E distutils.errors.DistutilsError: http://http://svn.pythonpaste.org/Paste/wphp/trunk nonnumeric port: ''
../../BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages/setuptools/package_index.py:763: DistutilsError
____________________________________________________________________ test_pip_upgrade_from_source[None] ____________________________________________________________________
pip_version = None, venv_without_setuptools = <setuptools.tests.environment.VirtualEnv object at 0x7f315ef6d460>
setuptools_wheel = PosixPath('/tmp/pytest-of-tkloczko/wheel_build/setuptools-60.5.4.post20220117-py3-none-any.whl')
setuptools_sdist = PosixPath('/tmp/pytest-of-tkloczko/sdist_build/setuptools-60.5.4.post20220117.tar.gz')
@pytest.mark.skipif(
'platform.python_implementation() == "PyPy"',
reason="https://github.com/pypa/setuptools/pull/2865#issuecomment-965834995",
)
@pytest.mark.parametrize('pip_version', _get_pip_versions())
def test_pip_upgrade_from_source(pip_version, venv_without_setuptools,
setuptools_wheel, setuptools_sdist):
"""
Check pip can upgrade setuptools from source.
"""
# Install pip/wheel, in a venv without setuptools (as it
# should not be needed for bootstraping from source)
venv = venv_without_setuptools
venv.run(["pip", "install", "-U", "wheel"])
if pip_version is not None:
venv.run(["python", "-m", "pip", "install", "-U", pip_version, "--retries=1"])
with pytest.raises(subprocess.CalledProcessError):
# Meta-test to make sure setuptools is not installed
> venv.run(["python", "-c", "import setuptools"])
E Failed: DID NOT RAISE <class 'subprocess.CalledProcessError'>
setuptools/tests/test_virtualenv.py:97: Failed
-------------------------------------------------------------------------- Captured stdout setup ---------------------------------------------------------------------------
created virtual environment CPython3.8.12.final.0-64 in 198ms
creator CPython3Posix(dest=/tmp/pytest-of-tkloczko/pytest-51/test_pip_upgrade_from_source_N0/venv/.env, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(extra_search_dir=/usr/lib64/python3.8/ensurepip/_bundled, /usr/share/python-wheels,download=False, pip=bundle, wheel=bundle, via=copy, app_data_dir=/home/tkloczko/.local/share/virtualenv)
added seed packages: pip==21.3.1, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
Processing /tmp/pytest-of-tkloczko/wheel_build/setuptools-60.5.4.post20220117-py3-none-any.whl
Installing collected packages: setuptools
Attempting uninstall: setuptools
Found existing installation: setuptools 60.5.4.post20220119
Not uninstalling setuptools at /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages, outside environment /tmp/pytest-of-tkloczko/pytest-51/test_pip_upgrade_from_source_N0/venv/.env
Can't uninstall 'setuptools'. No files were found to uninstall.
Successfully installed setuptools-60.5.4.post20220117
created virtual environment CPython3.8.12.final.0-64 in 199ms
creator CPython3Posix(dest=/tmp/pytest-of-tkloczko/pytest-51/test_pip_upgrade_from_source_N0/venv_without_setuptools/.env, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(extra_search_dir=/usr/lib64/python3.8/ensurepip/_bundled, /usr/share/python-wheels,download=False, pip=bundle, wheel=bundle, via=copy, app_data_dir=/home/tkloczko/.local/share/virtualenv)
added seed packages: pip==21.3.1, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
__________________________________________________________________ test_pip_upgrade_from_source[pip<20.1] __________________________________________________________________
pip_version = 'pip<20.1', venv_without_setuptools = <setuptools.tests.environment.VirtualEnv object at 0x7f315f53ffd0>
setuptools_wheel = PosixPath('/tmp/pytest-of-tkloczko/wheel_build/setuptools-60.5.4.post20220117-py3-none-any.whl')
setuptools_sdist = PosixPath('/tmp/pytest-of-tkloczko/sdist_build/setuptools-60.5.4.post20220117.tar.gz')
@pytest.mark.skipif(
'platform.python_implementation() == "PyPy"',
reason="https://github.com/pypa/setuptools/pull/2865#issuecomment-965834995",
)
@pytest.mark.parametrize('pip_version', _get_pip_versions())
def test_pip_upgrade_from_source(pip_version, venv_without_setuptools,
setuptools_wheel, setuptools_sdist):
"""
Check pip can upgrade setuptools from source.
"""
# Install pip/wheel, in a venv without setuptools (as it
# should not be needed for bootstraping from source)
venv = venv_without_setuptools
venv.run(["pip", "install", "-U", "wheel"])
if pip_version is not None:
venv.run(["python", "-m", "pip", "install", "-U", pip_version, "--retries=1"])
with pytest.raises(subprocess.CalledProcessError):
# Meta-test to make sure setuptools is not installed
> venv.run(["python", "-c", "import setuptools"])
E Failed: DID NOT RAISE <class 'subprocess.CalledProcessError'>
setuptools/tests/test_virtualenv.py:97: Failed
-------------------------------------------------------------------------- Captured stdout setup ---------------------------------------------------------------------------
created virtual environment CPython3.8.12.final.0-64 in 199ms
creator CPython3Posix(dest=/tmp/pytest-of-tkloczko/pytest-51/test_pip_upgrade_from_source_p1/venv/.env, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(extra_search_dir=/usr/lib64/python3.8/ensurepip/_bundled, /usr/share/python-wheels,download=False, pip=bundle, wheel=bundle, via=copy, app_data_dir=/home/tkloczko/.local/share/virtualenv)
added seed packages: pip==21.3.1, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
Processing /tmp/pytest-of-tkloczko/wheel_build/setuptools-60.5.4.post20220117-py3-none-any.whl
Installing collected packages: setuptools
Attempting uninstall: setuptools
Found existing installation: setuptools 60.5.4.post20220119
Not uninstalling setuptools at /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages, outside environment /tmp/pytest-of-tkloczko/pytest-51/test_pip_upgrade_from_source_p1/venv/.env
Can't uninstall 'setuptools'. No files were found to uninstall.
Successfully installed setuptools-60.5.4.post20220117
created virtual environment CPython3.8.12.final.0-64 in 201ms
creator CPython3Posix(dest=/tmp/pytest-of-tkloczko/pytest-51/test_pip_upgrade_from_source_p1/venv_without_setuptools/.env, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(extra_search_dir=/usr/lib64/python3.8/ensurepip/_bundled, /usr/share/python-wheels,download=False, pip=bundle, wheel=bundle, via=copy, app_data_dir=/home/tkloczko/.local/share/virtualenv)
added seed packages: pip==21.3.1, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
___________________________________________________________________ test_pip_upgrade_from_source[pip<21] ___________________________________________________________________
pip_version = 'pip<21', venv_without_setuptools = <setuptools.tests.environment.VirtualEnv object at 0x7f315f39b190>
setuptools_wheel = PosixPath('/tmp/pytest-of-tkloczko/wheel_build/setuptools-60.5.4.post20220117-py3-none-any.whl')
setuptools_sdist = PosixPath('/tmp/pytest-of-tkloczko/sdist_build/setuptools-60.5.4.post20220117.tar.gz')
@pytest.mark.skipif(
'platform.python_implementation() == "PyPy"',
reason="https://github.com/pypa/setuptools/pull/2865#issuecomment-965834995",
)
@pytest.mark.parametrize('pip_version', _get_pip_versions())
def test_pip_upgrade_from_source(pip_version, venv_without_setuptools,
setuptools_wheel, setuptools_sdist):
"""
Check pip can upgrade setuptools from source.
"""
# Install pip/wheel, in a venv without setuptools (as it
# should not be needed for bootstraping from source)
venv = venv_without_setuptools
venv.run(["pip", "install", "-U", "wheel"])
if pip_version is not None:
venv.run(["python", "-m", "pip", "install", "-U", pip_version, "--retries=1"])
with pytest.raises(subprocess.CalledProcessError):
# Meta-test to make sure setuptools is not installed
> venv.run(["python", "-c", "import setuptools"])
E Failed: DID NOT RAISE <class 'subprocess.CalledProcessError'>
setuptools/tests/test_virtualenv.py:97: Failed
-------------------------------------------------------------------------- Captured stdout setup ---------------------------------------------------------------------------
created virtual environment CPython3.8.12.final.0-64 in 198ms
creator CPython3Posix(dest=/tmp/pytest-of-tkloczko/pytest-51/test_pip_upgrade_from_source_p2/venv/.env, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(extra_search_dir=/usr/lib64/python3.8/ensurepip/_bundled, /usr/share/python-wheels,download=False, pip=bundle, wheel=bundle, via=copy, app_data_dir=/home/tkloczko/.local/share/virtualenv)
added seed packages: pip==21.3.1, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
Processing /tmp/pytest-of-tkloczko/wheel_build/setuptools-60.5.4.post20220117-py3-none-any.whl
Installing collected packages: setuptools
Attempting uninstall: setuptools
Found existing installation: setuptools 60.5.4.post20220119
Not uninstalling setuptools at /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages, outside environment /tmp/pytest-of-tkloczko/pytest-51/test_pip_upgrade_from_source_p2/venv/.env
Can't uninstall 'setuptools'. No files were found to uninstall.
Successfully installed setuptools-60.5.4.post20220117
created virtual environment CPython3.8.12.final.0-64 in 199ms
creator CPython3Posix(dest=/tmp/pytest-of-tkloczko/pytest-51/test_pip_upgrade_from_source_p2/venv_without_setuptools/.env, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(extra_search_dir=/usr/lib64/python3.8/ensurepip/_bundled, /usr/share/python-wheels,download=False, pip=bundle, wheel=bundle, via=copy, app_data_dir=/home/tkloczko/.local/share/virtualenv)
added seed packages: pip==21.3.1, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
___________________________________________________________________ test_pip_upgrade_from_source[pip<22] ___________________________________________________________________
pip_version = 'pip<22', venv_without_setuptools = <setuptools.tests.environment.VirtualEnv object at 0x7f315f1a3ca0>
setuptools_wheel = PosixPath('/tmp/pytest-of-tkloczko/wheel_build/setuptools-60.5.4.post20220117-py3-none-any.whl')
setuptools_sdist = PosixPath('/tmp/pytest-of-tkloczko/sdist_build/setuptools-60.5.4.post20220117.tar.gz')
@pytest.mark.skipif(
'platform.python_implementation() == "PyPy"',
reason="https://github.com/pypa/setuptools/pull/2865#issuecomment-965834995",
)
@pytest.mark.parametrize('pip_version', _get_pip_versions())
def test_pip_upgrade_from_source(pip_version, venv_without_setuptools,
setuptools_wheel, setuptools_sdist):
"""
Check pip can upgrade setuptools from source.
"""
# Install pip/wheel, in a venv without setuptools (as it
# should not be needed for bootstraping from source)
venv = venv_without_setuptools
venv.run(["pip", "install", "-U", "wheel"])
if pip_version is not None:
venv.run(["python", "-m", "pip", "install", "-U", pip_version, "--retries=1"])
with pytest.raises(subprocess.CalledProcessError):
# Meta-test to make sure setuptools is not installed
> venv.run(["python", "-c", "import setuptools"])
E Failed: DID NOT RAISE <class 'subprocess.CalledProcessError'>
setuptools/tests/test_virtualenv.py:97: Failed
-------------------------------------------------------------------------- Captured stdout setup ---------------------------------------------------------------------------
created virtual environment CPython3.8.12.final.0-64 in 198ms
creator CPython3Posix(dest=/tmp/pytest-of-tkloczko/pytest-51/test_pip_upgrade_from_source_p3/venv/.env, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(extra_search_dir=/usr/lib64/python3.8/ensurepip/_bundled, /usr/share/python-wheels,download=False, pip=bundle, wheel=bundle, via=copy, app_data_dir=/home/tkloczko/.local/share/virtualenv)
added seed packages: pip==21.3.1, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
Processing /tmp/pytest-of-tkloczko/wheel_build/setuptools-60.5.4.post20220117-py3-none-any.whl
Installing collected packages: setuptools
Attempting uninstall: setuptools
Found existing installation: setuptools 60.5.4.post20220119
Not uninstalling setuptools at /home/tkloczko/rpmbuild/BUILDROOT/python-setuptools-60.5.4-2.fc35.x86_64/usr/lib/python3.8/site-packages, outside environment /tmp/pytest-of-tkloczko/pytest-51/test_pip_upgrade_from_source_p3/venv/.env
Can't uninstall 'setuptools'. No files were found to uninstall.
Successfully installed setuptools-60.5.4.post20220117
created virtual environment CPython3.8.12.final.0-64 in 199ms
creator CPython3Posix(dest=/tmp/pytest-of-tkloczko/pytest-51/test_pip_upgrade_from_source_p3/venv_without_setuptools/.env, clear=False, no_vcs_ignore=False, global=False)
seeder FromAppData(extra_search_dir=/usr/lib64/python3.8/ensurepip/_bundled, /usr/share/python-wheels,download=False, pip=bundle, wheel=bundle, via=copy, app_data_dir=/home/tkloczko/.local/share/virtualenv)
added seed packages: pip==21.3.1, wheel==0.37.1
activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator
========================================================================= short test summary info ==========================================================================
SKIPPED [2] setuptools/tests/test_msvc.py:17: could not import 'distutils.msvc9compiler': No module named 'winreg'
SKIPPED [1] setuptools/tests/test_develop.py:66: TODO: needs a fixture to cause 'develop' to be invoked without mutating environment.
SKIPPED [1] setuptools/tests/test_install_scripts.py:50: Windows only
SKIPPED [1] setuptools/tests/test_install_scripts.py:78: Windows only
SKIPPED [5] setuptools/tests/test_integration.py:31: Integration tests cannot run when pbr is installed
SKIPPED [1] setuptools/tests/test_msvc14.py:16: These tests are only for win32
SKIPPED [1] setuptools/tests/test_msvc14.py:34: These tests are only for win32
SKIPPED [1] setuptools/tests/test_msvc14.py:52: These tests are only for win32
SKIPPED [1] setuptools/tests/test_msvc14.py:68: These tests are only for win32
SKIPPED [1] setuptools/tests/test_windows_wrappers.py:80: Windows only
SKIPPED [1] setuptools/tests/test_windows_wrappers.py:121: Windows only
SKIPPED [1] setuptools/tests/test_windows_wrappers.py:180: Windows only
SKIPPED [8] conftest.py:68: skipping integration tests
XFAIL setuptools/tests/test_bdist_egg.py::Test::test_exclude_source_files
Byte code disabled
XFAIL setuptools/tests/test_dist.py::test_read_metadata[Metadata Version 1.2: Project-Url-attrs5]
Issue #1578: project_urls not read
XFAIL setuptools/tests/test_dist.py::test_read_metadata[Metadata Version 2.1: Provides Extra-attrs9]
provides_extras not read
XFAIL setuptools/tests/test_egg_info.py::TestEggInfo::test_requires[extras_require_with_marker_in_setup_cfg]
XFAIL setuptools/tests/test_virtualenv.py::test_pip_upgrade_from_source[pip<20]
pypa/pip#6599
XFAIL setuptools/tests/test_virtualenv.py::test_pip_upgrade_from_source[https://github.com/pypa/pip/archive/main.zip]
#2975
XPASS setuptools/tests/test_archive_util.py::test_unicode_files #710 and #712
FAILED setuptools/tests/test_develop.py::TestNamespaces::test_editable_prefix - subprocess.CalledProcessError: Command '[PosixPath('/tmp/pytest-of-tkloczko/pytest-51/tes...
FAILED setuptools/tests/test_easy_install.py::TestEasyInstallTest::test_write_exception - distutils.errors.DistutilsError: can't create or remove files in install directory
FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_honors_pip_env - distutils.errors.DistutilsError: Command '['/usr/bin/python3', '-m'...
FAILED setuptools/tests/test_easy_install.py::TestSetupRequires::test_setup_requires_with_allow_hosts - distutils.errors.DistutilsError: the `allow-hosts` option is not ...
FAILED setuptools/tests/test_packageindex.py::TestPackageIndex::test_bad_url_double_scheme - distutils.errors.DistutilsError: http://http://svn.pythonpaste.org/Paste/wph...
FAILED setuptools/tests/test_virtualenv.py::test_pip_upgrade_from_source[None] - Failed: DID NOT RAISE <class 'subprocess.CalledProcessError'>
FAILED setuptools/tests/test_virtualenv.py::test_pip_upgrade_from_source[pip<20.1] - Failed: DID NOT RAISE <class 'subprocess.CalledProcessError'>
FAILED setuptools/tests/test_virtualenv.py::test_pip_upgrade_from_source[pip<21] - Failed: DID NOT RAISE <class 'subprocess.CalledProcessError'>
FAILED setuptools/tests/test_virtualenv.py::test_pip_upgrade_from_source[pip<22] - Failed: DID NOT RAISE <class 'subprocess.CalledProcessError'>
=============================================== 9 failed, 558 passed, 25 skipped, 6 xfailed, 1 xpassed in 201.67s (0:03:21) ================================================ |
# Install pip/wheel, in a venv without setuptools (as it
# should not be needed for bootstraping from source)
venv = venv_without_setuptools
venv.run(["pip", "install", "-U", "wheel"])
if pip_version is not None:
venv.run(["python", "-m", "pip", "install", "-U", pip_version, "--retries=1"])
with pytest.raises(subprocess.CalledProcessError):
# Meta-test to make sure setuptools is not installed
> venv.run(["python", "-c", "import setuptools"])
E Failed: DID NOT RAISE <class 'subprocess.CalledProcessError'> does it mean that in case this unit it tries to use hardcoded |
In that specific case, it tries to run |
Hi @kloczek, can we try to reproduce the errors you are seeing in a more controlled environment, without the extra patches to setuptools and the supporting libraries? (i.e. using a container that derives from the The following Dockerfile seems to run without problems: FROM python:3.8
RUN python3 -m pip install -U pip 'setuptools[testing]'
RUN git clone https://github.com/pypa/setuptools && \
cd setuptools/ && \
git fetch origin pull/3015/head && \
git checkout -b pr-3015 FETCH_HEAD
WORKDIR /setuptools
ENTRYPOINT ["pytest", "-vv", "-x", "-ra", "-p", "no:random", "setuptools"] Please also notice that the objective of this PR is to "improve" the situation when trying to run tests against a installed version of setuptools, however it does not guarantee that everything will use that installed version for the reasons I described in the linked issue. That is impossible with the current layout of the repository and design of the tests (with no current plans of adding support). I also tested As explained in the related issue, changing the layout has a lot of downsides and therefore is currently out of the table. A final comment: if you adopt this patch but the PR gets closed (which I am very inclined to do BTW, because it looks too hack-y...), I am afraid you are going to have to maintain it on your own. I am more than happy to review future PRs improving test isolation derived from your future patches (e.g. changing absolute imports in the test files to relative imports). |
Summary of changes
Configure the CI to prevent using
usedevelop=True
intox.ini
.To avoid running into the problems described in #2318 (comment), this PR also renames
setuptools/tests/{fixtures => conftest}.py
(this relies on pytest per-dir local plugins).This PR does not adopt the
changedir
trick (extra measure for test isolation) described in https://blog.ganssle.io/articles/2019/08/test-as-installed.html.Closes #2318 (partially?)
Pull Request Checklist
changelog.d/
.(See documentation for details)