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

Add configuration options to README #8

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,20 @@ This project is in a very early stage and will be both restructured and renamed.

## Quickstart

to install the python and other developer requirements into a venv run:
To install the python and other developer requirements into a venv run:

make install

#### Usable env vars

There's a few env vars that can be used with this project:

* `TEST_TARGET`: Set to `AWS_CLOUD` to use an externally-deployed instance when running tests.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: In the future this shouldn't be part of the library. For now it's ok to include it in the README as it's still included 👍

* `TEST_FORCE_SNAPSHOT_SKIP_VERIFY`: Set to `1` to force applying the snapshot filters regardless of what `TEST_TARGET` is set to.
* `SNAPSHOT_LEGACY_REPORT`: By default set to `0`. Can be set to `1`.
* `SNAPSHOT_UDPATE`: By default set to `0`. Can be set to `1`.
* `SNAPSHOT_RAW`: By default set to `0`. Can be set to `1`.
Comment on lines +20 to +22
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: extend with what effect enabling these variables will have


## Format code

We use black and isort as code style tools.
Expand Down
12 changes: 11 additions & 1 deletion localstack_snapshot/pytest/snapshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ def is_aws():
return os.environ.get("TEST_TARGET", "") == "AWS_CLOUD"


def force_skipping_snapshot_verify():
"""
Forces skipping verification according to the snapshot configuration.
Useful when is_aws() evaluates to True, but the target is actually an LS instance.
"""
return os.environ.get("TEST_FORCE_SNAPSHOT_SKIP_VERIFY", "") == "1"


@pytest.hookimpl
def pytest_configure(config: Config):
config.addinivalue_line("markers", "skip_snapshot_verify")
Expand Down Expand Up @@ -68,7 +76,9 @@ def pytest_runtest_call(item: Item) -> None:
verify = True
paths = []

if not is_aws(): # only skip for local tests
if (
not is_aws() or force_skipping_snapshot_verify()
): # only skip for local tests unless overridden
for m in item.iter_markers(name="skip_snapshot_verify"):
skip_paths = m.kwargs.get("paths", [])

Expand Down