Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 15 additions & 0 deletions .coveragerc_no_lang_ext
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Coverage config for `make test` which skips cfn_language_extensions tests.
# Extends the base .coveragerc and also excludes the language extensions source
# so coverage % isn't penalized when those tests are skipped.
[run]
branch = True
omit =
samcli/lib/cfn_language_extensions/*
# Inherited from .coveragerc
samcli/lib/iac/plugins_interfaces.py
samcli/lib/init/templates/*
samcli/hook_packages/terraform/copy_terraform_built_artifacts.py
[report]
exclude_lines =
pragma: no cover
raise NotImplementedError.*
28 changes: 23 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,19 @@ init:
fi

test:
# Run unit tests and fail if coverage falls below 94%
# Run unit tests (excluding cfn_language_extensions) and fail if coverage falls below 94%
pytest --cov samcli --cov schema --cov-report term-missing --cov-fail-under 94 tests/unit --ignore=tests/unit/lib/cfn_language_extensions --cov-config=.coveragerc_no_lang_ext

test-lang-ext:
# Run cfn_language_extensions unit tests with coverage
pytest --cov samcli.lib.cfn_language_extensions --cov-report term-missing --cov-fail-under 94 tests/unit/lib/cfn_language_extensions

test-all:
# Run all unit tests including cfn_language_extensions
pytest --cov samcli --cov schema --cov-report term-missing --cov-fail-under 94 tests/unit

test-cov-report:
# Run unit tests with html coverage report
# Run all unit tests with html coverage report
pytest --cov samcli --cov schema --cov-report html --cov-fail-under 94 tests/unit

integ-test:
Expand Down Expand Up @@ -46,7 +54,17 @@ lint:
mypy --exclude /testdata/ --exclude /init/templates/ --no-incremental setup.py samcli tests schema

# Command to run everytime you make changes to verify everything works
dev: lint test
# Runs test-all if cfn_language_extensions files changed, otherwise test
dev: lint
@if git diff --name-only origin/develop... 2>/dev/null | grep -qE 'cfn_language_extensions/'; then \
echo "Detected cfn_language_extensions changes — running all tests"; \
$(MAKE) test-all; \
else \
$(MAKE) test; \
fi

# Run full verification including language extensions tests
dev-all: lint test-all

black:
black setup.py samcli tests schema
Expand All @@ -64,8 +82,8 @@ format: black
schema:
python -m schema.make_schema

# Verifications to run before sending a pull request
pr: init schema black-check dev
# Verifications to run before sending a pull request — runs ALL tests
pr: init schema black-check lint test-all

# lucashuy: Linux and MacOS are on the same Python version,
# however we should follow up in a different change
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ max-statements = 80
"__init__.py" = ["F401", "E501"]
"integration_uri.py" = ["E501"] # ARNs are long.
"app.py" = ["E501"] # Doc links are long.
"samcli/lib/cfn_language_extensions/**/*.py" = ["PLR2004", "PLR0911", "PLR1714"] # Magic values and return statements are acceptable in intrinsic resolvers

[tool.black]
line-length = 120
Expand Down
Loading
Loading