Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Removes pytest-lazy-fixture dependency to allow pytest to be unpi…
Browse files Browse the repository at this point in the history
…nned (#388)
  • Loading branch information
desertaxle committed Feb 27, 2024
1 parent 3481235 commit f14daa4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
3 changes: 1 addition & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@ moto >= 3.1.16, < 4.2.5
mypy
pillow
pre-commit
pytest > 7, < 8
pytest
pytest-asyncio >= 0.18.2, != 0.22.0, < 0.23.0 # Cannot override event loop in 0.23.0. See https://github.com/pytest-dev/pytest-asyncio/issues/706 for more details.
pytest-cov
pytest-lazy-fixture
pytest-xdist
types-boto3 >= 1.0.2
7 changes: 4 additions & 3 deletions tests/test_lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import pytest
from botocore.response import StreamingBody
from moto import mock_iam, mock_lambda
from pytest_lazyfixture import lazy_fixture

from prefect_aws.credentials import AwsCredentials
from prefect_aws.lambda_function import LambdaFunction
Expand Down Expand Up @@ -232,8 +231,8 @@ def test_invoke_lambda_client_context(
@pytest.mark.parametrize(
"func_fixture,expected,handler",
[
(lazy_fixture("mock_lambda_function"), {"foo": "bar"}, handler_a),
(lazy_fixture("add_lambda_version"), {"data": [1, 2, 3]}, handler_b),
("mock_lambda_function", {"foo": "bar"}, handler_a),
("add_lambda_version", {"data": [1, 2, 3]}, handler_b),
],
)
def test_invoke_lambda_qualifier(
Expand All @@ -242,7 +241,9 @@ def test_invoke_lambda_qualifier(
expected,
lambda_function: LambdaFunction,
mock_invoke,
request,
):
func_fixture = request.getfixturevalue(func_fixture)
try:
lambda_function.qualifier = func_fixture["Version"]
result = lambda_function.invoke()
Expand Down
23 changes: 11 additions & 12 deletions tests/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from moto import mock_s3
from prefect import flow
from prefect.deployments import Deployment
from pytest_lazyfixture import lazy_fixture

from prefect_aws import AwsCredentials, MinIOCredentials
from prefect_aws.client_parameters import AwsClientParameters
Expand All @@ -22,9 +21,9 @@
)

aws_clients = [
(lazy_fixture("aws_client_parameters_custom_endpoint")),
(lazy_fixture("aws_client_parameters_empty")),
(lazy_fixture("aws_client_parameters_public_bucket")),
"aws_client_parameters_custom_endpoint",
"aws_client_parameters_empty",
"aws_client_parameters_public_bucket",
]


Expand All @@ -38,7 +37,7 @@ def s3_mock(monkeypatch, client_parameters):

@pytest.fixture
def client_parameters(request):
client_parameters = request.param
client_parameters = request.getfixturevalue(request.param)
return client_parameters


Expand Down Expand Up @@ -114,7 +113,7 @@ def a_lot_of_objects(bucket, tmp_path):

@pytest.mark.parametrize(
"client_parameters",
[lazy_fixture("aws_client_parameters_custom_endpoint")],
["aws_client_parameters_custom_endpoint"],
indirect=True,
)
async def test_s3_download_failed_with_wrong_endpoint_setup(
Expand All @@ -141,30 +140,30 @@ async def test_flow():
"client_parameters",
[
pytest.param(
lazy_fixture("aws_client_parameters_custom_endpoint"),
"aws_client_parameters_custom_endpoint",
marks=pytest.mark.is_public(False),
),
pytest.param(
lazy_fixture("aws_client_parameters_custom_endpoint"),
"aws_client_parameters_custom_endpoint",
marks=pytest.mark.is_public(True),
),
pytest.param(
lazy_fixture("aws_client_parameters_empty"),
"aws_client_parameters_empty",
marks=pytest.mark.is_public(False),
),
pytest.param(
lazy_fixture("aws_client_parameters_empty"),
"aws_client_parameters_empty",
marks=pytest.mark.is_public(True),
),
pytest.param(
lazy_fixture("aws_client_parameters_public_bucket"),
"aws_client_parameters_public_bucket",
marks=[
pytest.mark.is_public(False),
pytest.mark.xfail(reason="Bucket is not a public one"),
],
),
pytest.param(
lazy_fixture("aws_client_parameters_public_bucket"),
"aws_client_parameters_public_bucket",
marks=pytest.mark.is_public(True),
),
],
Expand Down

0 comments on commit f14daa4

Please sign in to comment.