Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip docker tests if docker is not installed #246

Merged
merged 3 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ branch = false
[tool.coverage.html]
title = "e3 aws coverage report"

[tool.pytest.ini_options]
addopts = "--failed-first --e3"

[tool.mypy]
# Ensure mypy works with namespace in which there is no toplevel
# __init__.py. Explicit_package_bases means that that mypy_path
Expand Down
1 change: 0 additions & 1 deletion tests/tests_e3_aws/dynamodb/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def test_batch_get_item_error(
# capture logs and ensure that are what we expect
messages.extend([x.message for x in caplog.get_records("call")]) # type: ignore

assert len(messages) == 2
assert (
"An error occurred (ResourceNotFoundException) when "
"calling the BatchGetItem operation: Requested resource not found" in messages
Expand Down
8 changes: 7 additions & 1 deletion tests/tests_e3_aws/troposphere/awslambda/awslambda_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,19 @@
)
from e3.aws.troposphere.awslambda.flask_apigateway_wrapper import FlaskLambdaHandler

from e3.pytest import require_tool

if TYPE_CHECKING:
from typing import Iterable
from flask import Application, Response


SOURCE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "source_dir")


has_docker = require_tool("docker")


EXPECTED_PY38FUNCTION_TEMPLATE = {
"Mypylambda": {
"Properties": {
Expand Down Expand Up @@ -452,7 +458,7 @@ def test_pyfunction_policy_document(stack: Stack) -> None:
assert stack.cfn_policy_document().as_dict == EXPECTED_PYFUNCTION_POLICY_DOCUMENT


def test_docker_function(stack: Stack) -> None:
def test_docker_function(stack: Stack, has_docker: pytest.Fixture) -> None:
"""Test adding docker function to stack."""
aws_env = AWSEnv(regions=["us-east-1"], stub=True)
stubber_ecr = aws_env.stub("ecr")
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ passenv = APPVEYOR*,CI,GITHUB_*,CODECOV_*

# Run testsuite with coverage when '-cov' is in the env name
commands=
pytest --ignore=build -vv --e3 \
pytest --ignore=build -vv \
cov: --e3-cov-rewrite {envsitepackagesdir} src \
cov: --cov {envsitepackagesdir}/e3/aws --cov-report= --cov-fail-under=0 \
[]
Expand Down
Loading