public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/pkgcore/pkgcore:master commit in: tests/ebuild/
@ 2022-11-11 17:33 Arthur Zamarin
  0 siblings, 0 replies; 3+ messages in thread
From: Arthur Zamarin @ 2022-11-11 17:33 UTC (permalink / raw
  To: gentoo-commits

commit:     9bf28884e787402e63b94c5450c1a4af98623220
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Fri Nov 11 17:28:09 2022 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Fri Nov 11 17:28:09 2022 +0000
URL:        https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=9bf28884

ebuild/test_eapi.py: fix test_register artifacts

test_register was leaving behind a bunch of files in the EBD_PATH, which
might pollute installation or venv. Create a temporary directory, into
which the ebd is copied and redirected for the duration of the test.

Bug: https://bugs.gentoo.org/880881
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 tests/ebuild/test_eapi.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/tests/ebuild/test_eapi.py b/tests/ebuild/test_eapi.py
index 3d1a98585..48ae0429d 100644
--- a/tests/ebuild/test_eapi.py
+++ b/tests/ebuild/test_eapi.py
@@ -1,6 +1,8 @@
+import shutil
 from unittest import mock
 
 import pytest
+from pkgcore.const import EBD_PATH
 from pkgcore.ebuild import eapi
 from pkgcore.ebuild.eapi import EAPI, eapi6, get_eapi
 
@@ -19,13 +21,15 @@ def test_get_eapi():
 
 class TestEAPI:
 
-    def test_register(self):
+    def test_register(self, tmp_path):
         # re-register known EAPI
         with pytest.raises(ValueError):
             EAPI.register(magic="0")
 
+        mock_ebd_temp = str(shutil.copytree(EBD_PATH, tmp_path / 'ebd'))
         with mock.patch('pkgcore.ebuild.eapi.bash_version') as bash_version, \
-                mock.patch.dict(eapi.EAPI.known_eapis):
+                mock.patch.dict(eapi.EAPI.known_eapis), \
+                mock.patch('pkgcore.ebuild.eapi.const.EBD_PATH', mock_ebd_temp):
             # inadequate bash version
             bash_version.return_value = '3.1'
             with pytest.raises(SystemExit) as excinfo:


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/pkgcore/pkgcore:master commit in: tests/ebuild/
@ 2023-02-02 20:26 Arthur Zamarin
  0 siblings, 0 replies; 3+ messages in thread
From: Arthur Zamarin @ 2023-02-02 20:26 UTC (permalink / raw
  To: gentoo-commits

commit:     afef868cd7c3a249864bdc2b4d98b74ef808be3f
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Thu Feb  2 20:25:10 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Thu Feb  2 20:25:10 2023 +0000
URL:        https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=afef868c

ebuild/test_eapi: fix tests artifacts in EBD_PATH

Bug: https://bugs.gentoo.org/888685
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 tests/ebuild/test_eapi.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tests/ebuild/test_eapi.py b/tests/ebuild/test_eapi.py
index cbe0e3a52..cf7ef0906 100644
--- a/tests/ebuild/test_eapi.py
+++ b/tests/ebuild/test_eapi.py
@@ -48,10 +48,13 @@ class TestEAPI:
             test_eapi = EAPI.register(magic="test1", optionals={"bash_compat": "4.1"})
             assert test_eapi._magic == "test1"
 
-    def test_is_supported(self, caplog):
+    def test_is_supported(self, tmp_path, caplog):
         assert eapi6.is_supported
 
-        with mock.patch.dict(eapi.EAPI.known_eapis):
+        mock_ebd_temp = str(shutil.copytree(EBD_PATH, tmp_path / "ebd"))
+        with mock.patch.dict(eapi.EAPI.known_eapis), mock.patch(
+            "pkgcore.ebuild.eapi.const.EBD_PATH", mock_ebd_temp
+        ):
             # partially supported EAPI is flagged as such
             test_eapi = EAPI.register("test", optionals={"is_supported": False})
             assert test_eapi.is_supported


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/pkgcore/pkgcore:master commit in: tests/ebuild/
@ 2023-12-26 17:45 Arthur Zamarin
  0 siblings, 0 replies; 3+ messages in thread
From: Arthur Zamarin @ 2023-12-26 17:45 UTC (permalink / raw
  To: gentoo-commits

commit:     036fefbbb07f089a3af2cd8bf423b0f4f606142b
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Mon Dec 25 21:55:36 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Tue Dec 26 17:43:58 2023 +0000
URL:        https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=036fefbb

fix: add atom test for 'foo/bar-11-r3'

CPV parsing was fixed (and test asserted) for this,
but atom parsing should also have a test to ensure
CPV changes don't let this slip through.

Signed-off-by: Brian Harring <ferringb <AT> gmail.com>
Closes: https://github.com/pkgcore/pkgcore/pull/420
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 tests/ebuild/test_atom.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/ebuild/test_atom.py b/tests/ebuild/test_atom.py
index d13efa83c..3fa193aee 100644
--- a/tests/ebuild/test_atom.py
+++ b/tests/ebuild/test_atom.py
@@ -123,6 +123,7 @@ class TestAtom(TestRestriction):
         self.assertMatch(a, CPV.unversioned("kde-base/kde"))
         self.assertNotMatch(a, CPV.unversioned("kde-base/kde2"))
         self.assertMatch(a, CPV.versioned("kde-base/kde-3"))
+        pytest.raises(errors.MalformedAtom, self.kls, "foo/bar-11-r3")
 
     def make_atom(self, s, ops, ver):
         l = []


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-26 17:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-02 20:26 [gentoo-commits] proj/pkgcore/pkgcore:master commit in: tests/ebuild/ Arthur Zamarin
  -- strict thread matches above, loose matches on Subject: below --
2023-12-26 17:45 Arthur Zamarin
2022-11-11 17:33 Arthur Zamarin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox