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

Test case tweak #349

Merged
merged 5 commits into from
Sep 4, 2024
Merged

Test case tweak #349

merged 5 commits into from
Sep 4, 2024

Conversation

skrawcz
Copy link
Contributor

@skrawcz skrawcz commented Aug 31, 2024

Clarifies test case creation behavior and adds ability to override the action name

Changes

  • CLI command
  • docs
  • fixes some links

How I tested this

  • locally

Notes

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.

So that they describe the expected behavior better.
@skrawcz skrawcz requested a review from elijahbenizzy August 31, 2024 04:36
This now correctly handles cases where there was no failure in the action.

When an action fails we save the initial state that went in. However, when
an action succeeds, we would only store the final state for that action.
So now, if the action was successful, we go back to the prior sequence
ID to get its state as the input, and use the state from the action as the
desired final state. This assumes you want to say "hey here's expected
behavior, I want to enshrine it".

Adjusts docs with new option.
The docs refactor missed fixing some links.

This also throws in a regenerated state graph image too.
So demo data is only relevant for the local backend.
It also should use the `burr_path` env variable if present.
This is unclean because we leak encapsulation from the
actual burr local backend...
Copy link
Contributor

@elijahbenizzy elijahbenizzy left a comment

Choose a reason for hiding this comment

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

Looks good, some nits

base_dir = os.path.expanduser("~/.burr")
if not no_copy_demo_data:

if backend == "local" and not no_copy_demo_data:
Copy link
Contributor

Choose a reason for hiding this comment

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

Best to instantiate the settings module if we can -- that way it's more future-proof/solves your TODO

@@ -322,13 +333,19 @@ def import_from_file(file_path: str) -> ModuleType:
required=False,
help="Python file or fully qualified python module to import for custom serialization/deserialization.",
)
@click.option(
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to change this? A little unclear what this does -- worth adding a bit more docs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it provides the name of the action to test for the test case.

enables you to use output from somewhere else as input for another action easily.

- state loaded would be the ending state, so to get the starting state, we need to look at the prior sequence ID
"""
if after_action["status"] == "completed":
print("Action was successful so loading initial and expected state into test fixture.")
Copy link
Contributor

Choose a reason for hiding this comment

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

We should have logger.warn instead of print here as we use stdout.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

prints are used throughout here.

Copy link
Contributor

Choose a reason for hiding this comment

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

We shouldn't -- it sometimes will/sometimes won't parse, and you'll be putting that to a file. You want to be able to pipe it.


# TODO -- make this configurable through an env variable
To override the path, set a `burr_path` environment variable to the path you want to use.
Copy link
Contributor

Choose a reason for hiding this comment

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

Point out the settings class that corresponds to this

@elijahbenizzy elijahbenizzy merged commit 365c3e8 into main Sep 4, 2024
12 checks passed
@elijahbenizzy elijahbenizzy deleted the test_case_tweak branch September 4, 2024 23:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants