15
0
forked from pool/python-stripe

Accepting request 1139834 from devel:languages:python

- Drop patch also-skip-streaming.patch:
  * No longer needed.
- Add BuildRequires on new stripe-mock service, and run it during the
  check phase.

OBS-URL: https://build.opensuse.org/request/show/1139834
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-stripe?expand=0&rev=4
This commit is contained in:
2024-01-19 22:01:58 +00:00
committed by Git OBS Bridge
3 changed files with 13 additions and 46 deletions

View File

@@ -1,43 +0,0 @@
Index: stripe-7.12.0/tests/conftest.py
===================================================================
--- stripe-7.12.0.orig/tests/conftest.py
+++ stripe-7.12.0/tests/conftest.py
@@ -48,9 +48,9 @@ def pytest_addoption(parser):
def pytest_runtest_setup(item):
- if "http_client_mock" in item.fixturenames and item.config.getoption(
- "--nomock"
- ):
+ if (any([f in item.fixturenames
+ for f in ("http_client_mock", "http_client_mock_streaming")]) and
+ item.config.getoption("--nomock")):
pytest.skip(
"run stripe-mock locally and remove --nomock flag to run skipped tests"
)
Index: stripe-7.12.0/tests/api_resources/test_invoice.py
===================================================================
--- stripe-7.12.0.orig/tests/api_resources/test_invoice.py
+++ stripe-7.12.0/tests/api_resources/test_invoice.py
@@ -137,7 +137,7 @@ class TestInvoice(object):
)
assert isinstance(resource, stripe.Invoice)
- def test_can_iterate_lines(self):
+ def test_can_iterate_lines(self, http_client_mock):
resource = stripe.Invoice.retrieve(TEST_RESOURCE_ID)
assert isinstance(resource.lines.data, list)
assert isinstance(resource.lines.data[0], stripe.InvoiceLineItem)
Index: stripe-7.12.0/tests/api_resources/test_invoice_line_item.py
===================================================================
--- stripe-7.12.0.orig/tests/api_resources/test_invoice_line_item.py
+++ stripe-7.12.0/tests/api_resources/test_invoice_line_item.py
@@ -5,7 +5,7 @@ TEST_INVOICE_ID = "in_123"
class TestInvoiceLineItem(object):
- def test_deserialize(self):
+ def test_deserialize(self, http_client_mock):
invoice = stripe.Invoice.retrieve(TEST_INVOICE_ID)
assert isinstance(invoice.lines.data, list)
assert isinstance(invoice.lines.data[0], stripe.InvoiceLineItem)

View File

@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Jan 19 03:23:20 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Drop patch also-skip-streaming.patch:
* No longer needed.
- Add BuildRequires on new stripe-mock service, and run it during the
check phase.
-------------------------------------------------------------------
Wed Jan 17 03:12:47 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>

View File

@@ -25,8 +25,6 @@ URL: https://github.com/stripe/stripe-python
Source: https://files.pythonhosted.org/packages/source/s/stripe/stripe-%{version}.tar.gz
# PATCH-FIX-UPSTREAM gh#stripe/stripe-python#1195
Patch0: use-sys-executable.patch
# PATCH-FIX-OPENSUSE Skip tests that require mocked stripe service running
Patch1: also-skip-streaming.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest >= 6.0}
BuildRequires: %{python_module pytest-mock >= 2.0}
@@ -36,6 +34,7 @@ BuildRequires: %{python_module typing_extensions >= 4.5.0}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: stripe-mock
Requires: python-requests >= 2.20
Requires: python-typing_extensions >= 4.5.0
Conflicts: python-stripe-api
@@ -56,7 +55,10 @@ Python bindings for the Stripe API.
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest --nomock
stripe-mock &
pid=$!
%pytest
kill $pid
%files %{python_files}
%doc CHANGELOG.md README.md examples/