commit:     744458ad962b3b60529e674d82fc490039754c9b
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 20 10:19:51 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Mar 20 10:41:05 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=744458ad

dev-python/moto: Fix test failures related to 32-bit time_t

Closes: https://bugs.gentoo.org/834904
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../moto/files/moto-3.1.1-32bit-time_t.patch       | 68 ++++++++++++++++++++++
 dev-python/moto/moto-3.0.5.ebuild                  |  4 ++
 dev-python/moto/moto-3.1.1.ebuild                  |  4 ++
 3 files changed, 76 insertions(+)

diff --git a/dev-python/moto/files/moto-3.1.1-32bit-time_t.patch 
b/dev-python/moto/files/moto-3.1.1-32bit-time_t.patch
new file mode 100644
index 000000000000..f4ab312f0332
--- /dev/null
+++ b/dev-python/moto/files/moto-3.1.1-32bit-time_t.patch
@@ -0,0 +1,68 @@
+From 878ce5bfd58060324fe58cb0a84653c02d895be4 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgo...@gentoo.org>
+Date: Sun, 20 Mar 2022 10:19:18 +0100
+Subject: [PATCH] Fix test failures on systems with 32-bit time_t
+
+Skip tests if OverflowError is raised when boto3 is processing
+timestamps.  This is a known limitation of boto3 on 32-bit platforms
+(https://github.com/boto/botocore/issues/2355).
+
+Catching OverflowError is the best option here since some 32-bit
+platforms (e.g. NetBSD) use 64-bit time_t, and others are working
+on providing a switch to the 64-bit type (e.g. glibc).
+---
+ tests/test_acm/test_acm.py         |  5 ++++-
+ tests/test_budgets/test_budgets.py | 14 ++++++++++----
+ 2 files changed, 14 insertions(+), 5 deletions(-)
+
+diff --git a/tests/test_acm/test_acm.py b/tests/test_acm/test_acm.py
+index b48897c1..6594787a 100644
+--- a/tests/test_acm/test_acm.py
++++ b/tests/test_acm/test_acm.py
+@@ -160,7 +160,10 @@ def test_describe_certificate():
+     client = boto3.client("acm", region_name="eu-central-1")
+     arn = _import_cert(client)
+ 
+-    resp = client.describe_certificate(CertificateArn=arn)
++    try:
++        resp = client.describe_certificate(CertificateArn=arn)
++    except OverflowError:
++        pytest.skip("This test requires 64-bit time_t")
+     resp["Certificate"]["CertificateArn"].should.equal(arn)
+     resp["Certificate"]["DomainName"].should.equal(SERVER_COMMON_NAME)
+     resp["Certificate"]["Issuer"].should.equal("Moto")
+diff --git a/tests/test_budgets/test_budgets.py 
b/tests/test_budgets/test_budgets.py
+index 578a7298..b3de3121 100644
+--- a/tests/test_budgets/test_budgets.py
++++ b/tests/test_budgets/test_budgets.py
+@@ -22,9 +22,12 @@ def test_create_and_describe_budget_minimal_params():
+     )
+     resp["ResponseMetadata"]["HTTPStatusCode"].should.equal(200)
+ 
+-    budget = client.describe_budget(AccountId=ACCOUNT_ID, 
BudgetName="testbudget")[
+-        "Budget"
+-    ]
++    try:
++        budget = client.describe_budget(AccountId=ACCOUNT_ID, 
BudgetName="testbudget")[
++            "Budget"
++        ]
++    except OverflowError:
++        pytest.skip("This test requires 64-bit time_t")
+     budget.should.have.key("BudgetLimit")
+     budget["BudgetLimit"].should.have.key("Amount")
+     budget["BudgetLimit"]["Amount"].should.equal("10")
+@@ -140,7 +143,10 @@ def test_create_and_describe_all_budgets():
+         },
+     )
+ 
+-    res = client.describe_budgets(AccountId=ACCOUNT_ID)
++    try:
++        res = client.describe_budgets(AccountId=ACCOUNT_ID)
++    except OverflowError:
++        pytest.skip("This test requires 64-bit time_t")
+     res["Budgets"].should.have.length_of(1)
+ 
+ 
+-- 
+2.35.1
+

diff --git a/dev-python/moto/moto-3.0.5.ebuild 
b/dev-python/moto/moto-3.0.5.ebuild
index d9f4f6d9952b..7b6e9bb52114 100644
--- a/dev-python/moto/moto-3.0.5.ebuild
+++ b/dev-python/moto/moto-3.0.5.ebuild
@@ -55,6 +55,10 @@ BDEPEND="
 
 distutils_enable_tests pytest
 
+PATCHES=(
+       "${FILESDIR}"/moto-3.1.1-32bit-time_t.patch
+)
+
 python_test() {
        local EPYTEST_DESELECT=(
                # TODO

diff --git a/dev-python/moto/moto-3.1.1.ebuild 
b/dev-python/moto/moto-3.1.1.ebuild
index eeea7c760e83..507482aa33b7 100644
--- a/dev-python/moto/moto-3.1.1.ebuild
+++ b/dev-python/moto/moto-3.1.1.ebuild
@@ -54,6 +54,10 @@ BDEPEND="
 
 distutils_enable_tests pytest
 
+PATCHES=(
+       "${FILESDIR}"/moto-3.1.1-32bit-time_t.patch
+)
+
 python_test() {
        local EPYTEST_DESELECT=(
                # TODO

Reply via email to