Open kloczek opened 1 year ago
Does specifying PYTHONPATH in 'passenv' in the configuration at https://github.com/fedora-python/tox-current-env/blob/master/tests/fixtures/tox.ini help?
You should be able to run:
export TOX_TESTENV_PASSENV=PYTHONPATH
In %check to simulate that. That should get around couple of the failures.
# default tox produces output sorted by package names
> assert packages == sorted(
packages, key=lambda p: p.partition("==")[0].partition(" @ ")[0].lower()
)
E AssertionError: assert ['Babel==2.11...=2.13.0', ...] == ['alabaster==...==0.9.0', ...]
E At index 0 diff: 'Babel==2.11.0' != 'alabaster==0.7.12'
E Use -v to get more diff
This seems like a difference in sorting. Maybe tox sorts capital letters first?
# without a flag, the output must match tox defaults
if not flag:
> assert len(packages) == 3
E AssertionError: assert 4 == 3
E + where 4 = len(['py==1.11.0', 'six==1.16.0', 'test @ file:///tmp/pytest-of-tkloczko/pytest-487/popen-gw20/test_noquiet_installed_package0/projdir/.tox/.tmp/package/1/test-0.0.0.zip', 'tox-current-env==0.0.8'])
This I don't fully comprehend. tox-current-env==0.0.8
is not listed when I try this.
# default tox produces output sorted by package names > assert packages == sorted( packages, key=lambda p: p.partition("==")[0].partition(" @ ")[0].lower() ) E AssertionError: assert ['Babel==2.11...=2.13.0', ...] == ['alabaster==...==0.9.0', ...] E At index 0 diff: 'Babel==2.11.0' != 'alabaster==0.7.12' E Use -v to get more diff
This seems like a difference in sorting. Maybe tox sorts capital letters first?
Could you please test that assumption in https://github.com/fedora-python/tox-current-env/pull/54 ?
Does specifying PYTHONPATH in 'passenv' in the configuration at https://github.com/fedora-python/tox-current-env/blob/master/tests/fixtures/tox.ini help?
What you mean passenv
?
What exactly needs to be done?
Just tested tjose three commits from master and tjose units are still failing.
========================================================================= short test summary info ==========================================================================
SKIPPED [1] tests/test_integration.py:136: This test needs python3.6, 3.7, 3.8, 3.9 and 3.10 available in $PATH
SKIPPED [1] tests/test_integration.py:117: This test needs python3.6, 3.7, 3.8, 3.9 and 3.10 available in $PATH
SKIPPED [1] tests/test_integration.py:459: This test needs python3.6, 3.7, 3.8, 3.9 and 3.10 available in $PATH
XFAIL tests/test_integration.py::test_allenvs_print_deps_to_file_print_extras_to_other_file[True-True] - reason: Unsupported combination of parameters
FAILED tests/test_integration.py::test_noquiet_installed_packages[--print-deps-to=-] - AssertionError: assert ['Babel==2.11...==9.3.0', ...] == ['alabaster==...=2.11.0', ...]
FAILED tests/test_integration.py::test_noquiet_installed_packages[--current-env] - AssertionError: assert ['Babel==2.11...==9.3.0', ...] == ['alabaster==...=2.11.0', ...]
FAILED tests/test_integration.py::test_regular_run_native_toxenv - assert '/.tox/py38 is the exec_prefix' in "WARNING: Discarding $PYTHONPATH from environment, to override specify PYTHONPATH in 'passenv' in your configuration."
FAILED tests/test_integration.py::test_regular_after_first_print_deps_is_supported[--print-deps-to=-] - assert '/.tox/py38 is the exec_prefix' in "WARNING: Discarding $PYTHONPATH from environment, to override specify PYTHONPATH in 'passenv' in your configuration."
FAILED tests/test_integration.py::test_regular_after_first_print_deps_is_supported[--print-deps-to-file=-] - assert '/.tox/py38 is the exec_prefix' in "WARNING: Discarding $PYTHONPATH from environment, to override specify PYTHONPATH in 'passenv' in your configuration."
FAILED tests/test_integration.py::test_noquiet_installed_packages[None] - AssertionError: assert 4 == 3
FAILED tests/test_integration.py::test_regular_after_first_print_deps_is_supported[--print-deps-only] - assert '/.tox/py38 is the exec_prefix' in "WARNING: Discarding $PYTHONPATH from environment, to override specify PYTHONPATH in 'passenv' in your configuration."
=========================================================== 7 failed, 122 passed, 3 skipped, 1 xfailed in 17.44s ===========================================================
Does specifying PYTHONPATH in 'passenv' in the configuration at https://github.com/fedora-python/tox-current-env/blob/master/tests/fixtures/tox.ini help?
What you mean
passenv
? What exactly needs to be done?
Either export TOX_TESTENV_PASSENV=PYTHONPATH
or edit https://github.com/fedora-python/tox-current-env/blob/master/tests/fixtures/tox.ini to add this to testenv:
passenv =
PYTHONPATH
Just tested tjose three commits
What 3 commits from master? There are no commits in master related to any of the failures mentioned here.
What 3 commits from master? There are no commits in master related to any of the failures mentioned here.
Yes commits from master.
TOX_TESTENV_PASSENV=PYTHONPATH
OK with that ebv variable I have now three failing units
========================================================================= short test summary info ==========================================================================
SKIPPED [1] tests/test_integration.py:136: This test needs python3.6, 3.7, 3.8, 3.9 and 3.10 available in $PATH
SKIPPED [1] tests/test_integration.py:117: This test needs python3.6, 3.7, 3.8, 3.9 and 3.10 available in $PATH
SKIPPED [1] tests/test_integration.py:459: This test needs python3.6, 3.7, 3.8, 3.9 and 3.10 available in $PATH
XFAIL tests/test_integration.py::test_allenvs_print_deps_to_file_print_extras_to_other_file[True-True] - reason: Unsupported combination of parameters
FAILED tests/test_integration.py::test_noquiet_installed_packages[--current-env] - AssertionError: assert ['Babel==2.11...==9.3.0', ...] == ['alabaster==...=2.11.0', ...]
FAILED tests/test_integration.py::test_noquiet_installed_packages[--print-deps-to=-] - AssertionError: assert ['Babel==2.11...==9.3.0', ...] == ['alabaster==...=2.11.0', ...]
FAILED tests/test_integration.py::test_noquiet_installed_packages[None] - AssertionError: assert 4 == 3
=========================================================== 3 failed, 126 passed, 3 skipped, 1 xfailed in 17.29s ===========================================================
and if you add https://github.com/fedora-python/tox-current-env/pull/54 ?
O with above input resources
Source: %{VCS}/archive/v%{version}/%{name}-%{version}.tar.gz
Patch: %{VCS}/commit/d2f93448.patch#/%{name}-tox-never-gets-capitalized.patch
Patch: %{VCS}/commit/4f97be79.patch#/%{name}-Define-and-use-a-tests-extra.patch
Patch: %{VCS}/commit/2f100547.patch#/%{name}-Update-the-branch-for-tox3-git.patch
Patch: %{VCS}/pull/54.patch#/%{name}-Tests-Dont-assume-tox-sorts-by-lowercase.patch
I still have one failing unit
__________________________________________________________________ test_noquiet_installed_packages[None] ___________________________________________________________________
[gw25] linux -- Python 3.8.16 /usr/bin/python3
flag = None
@pytest.mark.parametrize("flag", [None, "--print-deps-to=-", "--current-env"])
def test_noquiet_installed_packages(flag):
flags = (flag,) if flag else ()
result = tox("-e", NATIVE_TOXENV, *flags, quiet=False, check=False)
assert f"\n{NATIVE_TOXENV} installed: " in result.stdout
for line in result.stdout.splitlines():
if line.startswith(f"{NATIVE_TOXENV} installed: "):
packages = line.rpartition(" installed: ")[-1].split(",")
break
# default tox produces output sorted by package names
assert packages == sorted(
packages, key=lambda p: p.partition("==")[0].partition(" @ ")[0]
)
# without a flag, the output must match tox defaults
if not flag:
> assert len(packages) == 3
E AssertionError: assert 4 == 3
E + where 4 = len(['py==1.11.0', 'six==1.16.0', 'test @ file:///tmp/pytest-of-tkloczko/pytest-681/popen-gw25/test_noquiet_installed_package0/projdir/.tox/.tmp/package/1/test-0.0.0.zip', 'tox-current-env==0.0.8'])
/home/tkloczko/rpmbuild/BUILD/tox-current-env-0.0.8/tests/test_integration.py:625: AssertionError
--------------------------------------------------------------------------- Captured stdout call ---------------------------------------------------------------------------
GLOB sdist-make: /tmp/pytest-of-tkloczko/pytest-681/popen-gw25/test_noquiet_installed_package0/projdir/setup.py
py38 create: /tmp/pytest-of-tkloczko/pytest-681/popen-gw25/test_noquiet_installed_package0/projdir/.tox/py38
py38 installdeps: six, py
py38 inst: /tmp/pytest-of-tkloczko/pytest-681/popen-gw25/test_noquiet_installed_package0/projdir/.tox/.tmp/package/1/test-0.0.0.zip
py38 installed: py==1.11.0,six==1.16.0,test @ file:///tmp/pytest-of-tkloczko/pytest-681/popen-gw25/test_noquiet_installed_package0/projdir/.tox/.tmp/package/1/test-0.0.0.zip,tox-current-env==0.0.8
py38 run-test-pre: PYTHONHASHSEED='2206847846'
py38 run-test: commands[0] | python -c 'import os, sys; print(os.path.realpath(sys.exec_prefix), "is the exec_prefix")'
/tmp/pytest-of-tkloczko/pytest-681/popen-gw25/test_noquiet_installed_package0/projdir/.tox/py38 is the exec_prefix
___________________________________ summary ____________________________________
py38: commands succeeded
congratulations :)
--------------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------------
========================================================================= short test summary info ==========================================================================
SKIPPED [1] tests/test_integration.py:136: This test needs python3.6, 3.7, 3.8, 3.9 and 3.10 available in $PATH
SKIPPED [1] tests/test_integration.py:117: This test needs python3.6, 3.7, 3.8, 3.9 and 3.10 available in $PATH
SKIPPED [1] tests/test_integration.py:459: This test needs python3.6, 3.7, 3.8, 3.9 and 3.10 available in $PATH
XFAIL tests/test_integration.py::test_allenvs_print_deps_to_file_print_extras_to_other_file[True-True] - reason: Unsupported combination of parameters
FAILED tests/test_integration.py::test_noquiet_installed_packages[None] - AssertionError: assert 4 == 3
=========================================================== 1 failed, 128 passed, 3 skipped, 1 xfailed in 16.97s ===========================================================
I can reproduce that one only with TOX_TESTENV_PASSENV=PYTHONPATH set but not without.
The TOX_TESTENV_PASSENV=PYTHONPATH thing is a workaround, I guess the proper fix is to ignore the warning in the test output. Let me check.
With https://github.com/fedora-python/tox-current-env/pull/54 and https://github.com/fedora-python/tox-current-env/pull/55 and without TOX_TESTENV_PASSENV=PYTHONPATH all the tests pass for me when PYTHONPATH is set to buildroot site-packages.
I do however not use Python 3.8.
Don't worry about pytjon 3.8. I'll be soon moving all my modules to 3.9 and then to nect major version (I'l be going over all versions to test/perfect/polish python major version upgrade procedure).
Nevertheless as you are able to reporoduce that TOX_TESTENV_PASSENV=PYTHONPAT
as I have that coded in my build procedure looks like it is not python 3.8 specyfic issue.
Could you please try the following combination?
# without a flag, the output must match tox defaults if not flag: > assert len(packages) == 3 E AssertionError: assert 4 == 3 E + where 4 = len(['py==1.11.0', 'six==1.16.0', 'test @ file:///tmp/pytest-of-tkloczko/pytest-487/popen->gw20/test_noquiet_installed_package0/projdir/.tox/.tmp/package/1/test-0.0.0.zip', 'tox-current-env==0.0.8'])
This I don't fully comprehend. tox-current-env==0.0.8 is not listed when I try this.
I do have the exactly same problem:
if not flag:
> assert len(packages) == 3
E AssertionError: assert 4 == 3
E + where 4 = len(['py==1.11.0', 'six==1.16.0', 'test @ file:///tmp/pytest-of-marcel/pytest-60/popen-gw3/test_noquiet_installed_package0/projdir/.tox/.tmp/package/1/test-0.0.0.zip', 'tox-current-env==0.0.10'])
# without a flag, the output must match tox defaults if not flag: > assert len(packages) == 3 E AssertionError: assert 4 == 3 E + where 4 = len(['py==1.11.0', 'six==1.16.0', 'test @ file:///tmp/pytest-of-tkloczko/pytest-487/popen->gw20/test_noquiet_installed_package0/projdir/.tox/.tmp/package/1/test-0.0.0.zip', 'tox-current-env==0.0.8'])
This I don't fully comprehend. tox-current-env==0.0.8 is not listed when I try this.
I do have the exactly same problem:
if not flag: > assert len(packages) == 3 E AssertionError: assert 4 == 3 E + where 4 = len(['py==1.11.0', 'six==1.16.0', 'test @ file:///tmp/pytest-of-marcel/pytest-60/popen-gw3/test_noquiet_installed_package0/projdir/.tox/.tmp/package/1/test-0.0.0.zip', 'tox-current-env==0.0.10'])
This problem is gone with tox-current-env-0.0.11
(and tox-3.28.0
).
As latest pytest
has no llonger bundled py
modue tihs issue came to the surface.
Many modules aterted modify tha code to drop completely py
use and test suite dependency.
BTW .. the same should be done with six
😋
Kind of workaround is add standalone py
to the build env however this fould be only kind of temporary/JFDI solution.
Just found that another two units are now failing
@kloczek I've asked you to test with https://github.com/fedora-python/tox-current-env/pull/54
OK .. one sec 😋
That PR does nit applies on top of latest version
+ /usr/bin/tar -xof -
+ /usr/bin/gzip -dc /home/tkloczko/rpmbuild/SOURCES/python-tox-current-env-0.0.11.tar.gz
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd tox-current-env-0.0.11
+ /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ /usr/bin/cat /home/tkloczko/rpmbuild/SOURCES/python-tox-current-env-Tests-Dont-assume-tox-sorts-by-lowercase.patch
+ /usr/bin/patch -p1 -s --fuzz=0 --no-backup-if-mismatch -f
The text leading up to this was:
--------------------------
|From 096d986fd61de9d291eac6756c2385dd43de03f1 Mon Sep 17 00:00:00 2001
|From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
|Date: Thu, 8 Dec 2022 11:48:14 +0100
|Subject: [PATCH] Tests: Don't assume tox sorts by lowercase
|
|Partial fix for https://github.com/fedora-python/tox-current-env/issues/52
|---
| tests/test_integration.py | 2 +-
| 1 file changed, 1 insertion(+), 1 deletion(-)
|
|diff --git a/tests/test_integration.py b/tests/test_integration.py
|index 09abd46..a6dd78b 100644
|--- a/tests/test_integration.py
|+++ b/tests/test_integration.py
--------------------------
No file to patch. Skipping patch.
1 out of 1 hunk ignored
It was rebased (before your comment).
I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
build
with--no-isolation
I'm using during all processes only locally installed modulesHere is pytest output:
Here is list of installed modules in build env