diff --git a/make_post_sell/tests/test_functional.py b/make_post_sell/tests/test_functional.py index 66fe211..d75abd0 100644 --- a/make_post_sell/tests/test_functional.py +++ b/make_post_sell/tests/test_functional.py @@ -1773,7 +1773,8 @@ class AuthenticatedFunctionalTests(FunctionalTests): f"{base_url}/v1/oauth2/token", headers={"Accept": "application/json", "Accept-Language": "en_US"}, data={"grant_type": "client_credentials"}, - auth=(paypal_client_id, paypal_secret) + auth=(paypal_client_id, paypal_secret), + timeout=10, ) self.assertEqual(auth_response.status_code, 200) @@ -1803,7 +1804,8 @@ class AuthenticatedFunctionalTests(FunctionalTests): f"{base_url}/v1/oauth2/token", headers={"Accept": "application/json", "Accept-Language": "en_US"}, data={"grant_type": "client_credentials"}, - auth=(paypal_client_id, paypal_secret) + auth=(paypal_client_id, paypal_secret), + timeout=10, ) self.assertEqual(auth_response.status_code, 200) @@ -1827,7 +1829,8 @@ class AuthenticatedFunctionalTests(FunctionalTests): "Content-Type": "application/json", "Authorization": f"Bearer {access_token}" }, - json=order_json + json=order_json, + timeout=10, ) self.assertEqual(order_response.status_code, 201) @@ -1943,7 +1946,8 @@ class AuthenticatedFunctionalTests(FunctionalTests): f"{base_url}/v1/oauth2/token", headers={"Accept": "application/json", "Accept-Language": "en_US"}, data={"grant_type": "client_credentials"}, - auth=(paypal_client_id, paypal_secret) + auth=(paypal_client_id, paypal_secret), + timeout=10, ) access_token = auth_response.json()["access_token"] @@ -1961,7 +1965,8 @@ class AuthenticatedFunctionalTests(FunctionalTests): "amount": {"currency_code": "USD", "value": "5.00"}, "description": "Test retrieval order" }] - } + }, + timeout=10, ) order_id = order_response.json()["id"] @@ -1969,7 +1974,8 @@ class AuthenticatedFunctionalTests(FunctionalTests): # Retrieve the order get_response = requests.get( f"{base_url}/v2/checkout/orders/{order_id}", - headers={"Authorization": f"Bearer {access_token}"} + headers={"Authorization": f"Bearer {access_token}"}, + timeout=10, ) self.assertEqual(get_response.status_code, 200) diff --git a/pytest.ini b/pytest.ini index 42f96ff..7e66d1d 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,6 +1,7 @@ [pytest] testpaths = make_post_sell python_files = test*.py +timeout = 60 # Uncomment filterwarnings to suppress external library warnings # filterwarnings = # # Ignore datetime.utcnow() deprecation from external libraries diff --git a/requirements-test.txt b/requirements-test.txt index 76b59ed..ec3ddfd 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,6 +1,7 @@ # testing. pytest pytest-cov +pytest-timeout # Per-test timeout safety net pytest-xdist # Parallel test execution nose mock