commit:     c8b30294591be75516e369ae9566885c47e594d3
Author:     David Palao <david.palao <AT> gmail <DOT> com>
AuthorDate: Wed May 17 13:38:42 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri May 26 15:44:37 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=c8b30294

tests: pytest: the last four failing tests with pytest fixed

The issue was: when the full test suite was run, the four tests
would fail. But not when they were run alone. The reason: the
environment where those tests was run on was wrong when the full
suite was run, and not when the individual tests were executed.

It was fixed by adding:

  "PORTAGE_INST_GID": str(os.getuid()),
  "PORTAGE_INST_UID": str(os.getgid()),

to the environments used by the commands exercised in those tests.

Signed-off-by: David Palao <david.palao <AT> gmail.com>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/tests/emerge/test_config_protect.py                | 4 ++--
 lib/portage/tests/emerge/test_emerge_blocker_file_collision.py | 2 ++
 lib/portage/tests/emerge/test_emerge_slot_abi.py               | 2 ++
 lib/portage/tests/emerge/test_simple.py                        | 4 ++--
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/portage/tests/emerge/test_config_protect.py 
b/lib/portage/tests/emerge/test_config_protect.py
index 399611ea1..0b8308a34 100644
--- a/lib/portage/tests/emerge/test_config_protect.py
+++ b/lib/portage/tests/emerge/test_config_protect.py
@@ -217,8 +217,8 @@ src_install() {
             "INFODIR": "",
             "INFOPATH": "",
             "PATH": path,
-            "PORTAGE_INST_GID": str(portage.data.portage_gid),
-            "PORTAGE_INST_UID": str(portage.data.portage_uid),
+            "PORTAGE_INST_GID": str(os.getuid()),  # 
str(portage.data.portage_gid),
+            "PORTAGE_INST_UID": str(os.getgid()),  # 
str(portage.data.portage_uid),
             "PORTAGE_PYTHON": portage_python,
             "PORTAGE_REPOSITORIES": settings.repositories.config_string(),
             "PORTAGE_TMPDIR": portage_tmpdir,

diff --git a/lib/portage/tests/emerge/test_emerge_blocker_file_collision.py 
b/lib/portage/tests/emerge/test_emerge_blocker_file_collision.py
index b160fe1c6..a05fc47a9 100644
--- a/lib/portage/tests/emerge/test_emerge_blocker_file_collision.py
+++ b/lib/portage/tests/emerge/test_emerge_blocker_file_collision.py
@@ -121,6 +121,8 @@ src_install() {
             "PORTAGE_REPOSITORIES": settings.repositories.config_string(),
             "PYTHONDONTWRITEBYTECODE": 
os.environ.get("PYTHONDONTWRITEBYTECODE", ""),
             "PYTHONPATH": pythonpath,
+            "PORTAGE_INST_GID": str(os.getuid()),
+            "PORTAGE_INST_UID": str(os.getgid()),
         }
 
         if "__PORTAGE_TEST_HARDLINK_LOCKS" in os.environ:

diff --git a/lib/portage/tests/emerge/test_emerge_slot_abi.py 
b/lib/portage/tests/emerge/test_emerge_slot_abi.py
index e38d0fcac..3fc13e08f 100644
--- a/lib/portage/tests/emerge/test_emerge_slot_abi.py
+++ b/lib/portage/tests/emerge/test_emerge_slot_abi.py
@@ -129,6 +129,8 @@ class SlotAbiEmergeTestCase(TestCase):
             "PORTAGE_REPOSITORIES": settings.repositories.config_string(),
             "PYTHONDONTWRITEBYTECODE": 
os.environ.get("PYTHONDONTWRITEBYTECODE", ""),
             "PYTHONPATH": pythonpath,
+            "PORTAGE_INST_GID": str(os.getuid()),
+            "PORTAGE_INST_UID": str(os.getgid()),
         }
 
         if "__PORTAGE_TEST_HARDLINK_LOCKS" in os.environ:

diff --git a/lib/portage/tests/emerge/test_simple.py 
b/lib/portage/tests/emerge/test_simple.py
index 0e5333250..86c5dccc4 100644
--- a/lib/portage/tests/emerge/test_simple.py
+++ b/lib/portage/tests/emerge/test_simple.py
@@ -620,8 +620,8 @@ call_has_and_best_version() {
             "INFOPATH": "",
             "PATH": path,
             "PKGDIR": pkgdir,
-            "PORTAGE_INST_GID": str(portage.data.portage_gid),
-            "PORTAGE_INST_UID": str(portage.data.portage_uid),
+            "PORTAGE_INST_GID": str(os.getuid()),  # 
str(portage.data.portage_gid),
+            "PORTAGE_INST_UID": str(os.getuid()),  # 
str(portage.data.portage_uid),
             "PORTAGE_PYTHON": portage_python,
             "PORTAGE_REPOSITORIES": settings.repositories.config_string(),
             "PORTAGE_TMPDIR": portage_tmpdir,

Reply via email to