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

F python -m approvaltests --approve #177

Open
nitsanavni opened this issue Oct 24, 2024 · 0 comments
Open

F python -m approvaltests --approve #177

nitsanavni opened this issue Oct 24, 2024 · 0 comments

Comments

@nitsanavni
Copy link
Contributor

General

CLI command to approve last failed approval tests.
This kind of command is useful for semi-automated development workflows.

Example

Consider a failing approval test:

# test_example.py
def test_example():
    verify("Approve me please!")
$ pytest -q test_example.py
pytest -q test_example.py
F                                                                                                   [100%]
================================================ FAILURES =================================================
______________________________________________ test_example _______________________________________________

    def test_example():
>       verify("Approve me please!")
E       approvaltests.approval_exception.ApprovalException: Approval Mismatch, received != approved

...

Approve it with:

$ python -m approvaltests --approve test_example

  ✅ test_example.test_example approved

The test now passes:

$ pytest -q test_example.py
.                                                                                                   [100%]
1 passed in 0.05s 

API

Potential API:

$ python -m approvaltests --approve <pattern>
$ python -m approvaltests --approve-all
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

No branches or pull requests

1 participant