Skip to content

Commit 0ba8971

Browse files
Update conftest.py
1 parent 41941a4 commit 0ba8971

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

tests/step_defs/conftest.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ def pytest_addoption(parser: 'pytest.Parser') -> None:
1414
"""
1515
parser.addoption("--mock-aws",
1616
action="store",
17-
default=True,
18-
type=bool,
17+
default="True",
18+
choices=["True", "False"],
19+
type=str,
1920
help="Boolean to indicate if AWS should be mocked"
2021
)
2122

@@ -30,7 +31,9 @@ def mock_aws_flag(request: 'pytest.FixtureRequest') -> bool:
3031
Returns:
3132
bool: Boolean indicating whether AWS should be mocked.
3233
"""
33-
mock_aws_flag = request.config.getoption("--mock-aws")
34+
mock_aws_value = request.config.getoption("--mock-aws")
35+
mock_aws_flag = mock_aws_value == "True"
36+
3437
return mock_aws_flag
3538

3639
@pytest.fixture(scope='module')
@@ -64,6 +67,8 @@ def setup(request: 'pytest.FixtureRequest', mock_aws_flag: bool, log: CustomLogg
6467
def teardown():
6568
# Teardown mocked AWS environment
6669
mock.stop()
70+
71+
request.addfinalizer(teardown)
6772
else:
6873
# Setup LocalStack environment
6974
log.info("Creating real SQS client")

0 commit comments

Comments
 (0)