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

fix(report): correctly use pytest invocation arguments #507

Merged
merged 1 commit into from
Jun 1, 2021

Conversation

iamogbz
Copy link
Collaborator

@iamogbz iamogbz commented Jun 1, 2021

Description

Correct usage of pytest invocation arguments

Example

$ pytest --ff tests/syrupy/extensions/amber/test_amber_serializer.py
===================================== test session starts ======================================
platform darwin -- Python 3.9.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1
rootdir: /Users/Emmanuel/Sources/github/tophat/syrupy, configfile: pyproject.toml
plugins: syrupy-2021.5.31.224541039469
collected 57 items                                                                             
run-last-failure: no previously failed tests, not deselecting items.

tests/syrupy/extensions/amber/test_amber_serializer.py ................................. [ 57%]
........................                                                                 [100%]

----------------------------------- snapshot report summary ------------------------------------
69 snapshots passed. 8 snapshots unused.

Re-run pytest with --snapshot-update to delete unused snapshots.
====================================== 57 passed in 0.44s ======================================

Snapshots marked as unused: due to wrong parsing of invocation arguments

Also see modified failing tests.

Checklist

  • This PR has sufficient documentation.
  • This PR has sufficient test coverage.
  • This PR title satisfies semantic convention.

Additional Comments

N/A

@iamogbz iamogbz requested a review from noahnu June 1, 2021 04:33
include_snapshot_details: bool = attr.ib()
_invocation_args: Tuple[str, ...] = attr.ib(factory=tuple)
# pytest.Session
_pytest_session: Any = attr.ib()
Copy link
Collaborator

Choose a reason for hiding this comment

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

you can reference the type directly, no need for "Any"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was causing issues with mypy

@iamogbz iamogbz requested a review from noahnu June 1, 2021 17:10
@noahnu noahnu merged commit 8b511e5 into master Jun 1, 2021
@noahnu noahnu deleted the fix-use-pytest-provided-options branch June 1, 2021 23:35
tophat-opensource-bot pushed a commit that referenced this pull request Jun 1, 2021
## [1.2.4](v1.2.3...v1.2.4) (2021-06-01)

### Bug Fixes

* correctly use pytest invocation arguments ([#507](#507)) ([8b511e5](8b511e5))
@tophat-opensource-bot
Copy link
Collaborator

🎉 This PR is included in version 1.2.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants