diff mbox series

[meta-python,7/7] python3-betamax: Skip ptests accessing network

Message ID 20251210081607.3196421-7-raj.khem@gmail.com
State New
Headers show
Series [meta-networking,1/7] frr: Upgrade to 10.5.0 | expand

Commit Message

Khem Raj Dec. 10, 2025, 8:16 a.m. UTC
cassette fixtures are not installed in ptests so skip
test_requests_with_json_body

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...s-use-pytest-vcr-or-skip-if-cassette.patch | 40 +++++++++++++++++++
 .../python/python3-betamax_0.9.0.bb           |  1 +
 2 files changed, 41 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-betamax/0001-test_placeholders-use-pytest-vcr-or-skip-if-cassette.patch
diff mbox series

Patch

diff --git a/meta-python/recipes-devtools/python/python3-betamax/0001-test_placeholders-use-pytest-vcr-or-skip-if-cassette.patch b/meta-python/recipes-devtools/python/python3-betamax/0001-test_placeholders-use-pytest-vcr-or-skip-if-cassette.patch
new file mode 100644
index 0000000000..64ff9be249
--- /dev/null
+++ b/meta-python/recipes-devtools/python/python3-betamax/0001-test_placeholders-use-pytest-vcr-or-skip-if-cassette.patch
@@ -0,0 +1,40 @@ 
+From a7f1d08e073e60167c6ac9c72a0110c65f87a937 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 9 Dec 2025 23:04:45 -0800
+Subject: [PATCH] test_placeholders: use pytest-vcr or skip if cassette missing
+
+Upstream-Status: Inappropriate [OE ptest specific]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ tests/integration/test_placeholders.py | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/tests/integration/test_placeholders.py
++++ b/tests/integration/test_placeholders.py
+@@ -1,3 +1,6 @@
++import pytest
++import os
++
+ from betamax import Betamax
+ from betamax.cassette import Cassette
+
+@@ -18,6 +21,8 @@ class TestPlaceholders(IntegrationHelper
+         super(TestPlaceholders, self).tearDown()
+         Cassette.default_cassette_options = original_cassette_options
+
++    @pytest.mark.skipif(not os.path.exists('tests/cassettes/test_placeholders.json'),
++                    reason="Cassette fixture missing")
+     def test_placeholders_work(self):
+         placeholders = Cassette.default_cassette_options['placeholders']
+         assert placeholders == [{
+--- a/tests/regression/test_requests_2_11_body_matcher.py
++++ b/tests/regression/test_requests_2_11_body_matcher.py
+@@ -13,6 +13,7 @@ class TestRequests211BodyMatcher(unittes
+
+     @pytest.mark.skipif(requests.__build__ < 0x020401,
+                         reason="No json keyword.")
++    @pytest.mark.skip(reason="Requires cassette fixture not available in ptest")
+     def test_requests_with_json_body(self):
+         s = requests.Session()
+         with Betamax(s).use_cassette('requests_2_11_body_matcher',
diff --git a/meta-python/recipes-devtools/python/python3-betamax_0.9.0.bb b/meta-python/recipes-devtools/python/python3-betamax_0.9.0.bb
index f88d43a21a..8dbd21a938 100644
--- a/meta-python/recipes-devtools/python/python3-betamax_0.9.0.bb
+++ b/meta-python/recipes-devtools/python/python3-betamax_0.9.0.bb
@@ -10,6 +10,7 @@  SRC_URI += " \
         file://run-ptest \
         git://github.com/betamaxpy/betamax;protocol=https;branch=main \
         file://0001-Drop-ptests-fixtures-and-recorde_modes.patch \
+        file://0001-test_placeholders-use-pytest-vcr-or-skip-if-cassette.patch \
 "