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

Attempt to use mocker and reset os.remove #850

Conversation

treyhunner
Copy link
Contributor

Attempt to fix the os.remove issue noted in PR #848.

Merging this will merge into the code for #848.

Copy link
Collaborator

@RisingOrange RisingOrange left a comment

Choose a reason for hiding this comment

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

Nice!

@RisingOrange RisingOrange merged commit e93e3c2 into chore/use-pytest-mock-for-client-tests Dec 22, 2023
6 checks passed
@RisingOrange RisingOrange deleted the chore/use-pytest-mock-for-client-fix branch December 22, 2023 12:12
RisingOrange added a commit that referenced this pull request Dec 30, 2023
* chore: Replaces usages of monkeypatch in test_client.py

* Attempt to use mocker and reset os.remove (#850)

* Attempt to use mocker and reset os.remove

* Use mocker.resetall to reset all mocks

* Use stop (reset is just for the mock call values)

* Fix types: use mocker.stop on remove_mock

---------

Co-authored-by: Trey Hunner <[email protected]>
RisingOrange added a commit that referenced this pull request Dec 30, 2023
* Add pytest-mock to requirements

* chore: Replace usages of monkeypatch in test_unit.py

* Replace usages of `mock_function` in test_unit.py with `mocker.patch`

* Simplify raising exceptions

* Prefeer `mocker.patch` over `mocker.patch.object`

* Use mocker.stub() for mocking callbacks

* chore: Use pytest-mock in client tests (#848)

* chore: Replaces usages of monkeypatch in test_client.py

* Attempt to use mocker and reset os.remove (#850)

* Attempt to use mocker and reset os.remove

* Use mocker.resetall to reset all mocks

* Use stop (reset is just for the mock call values)

* Fix types: use mocker.stop on remove_mock

---------

Co-authored-by: Trey Hunner <[email protected]>

* Chore/use pytest mock for integration tests (#849)

* Replace some monkeypatch uses with pytest-mock

* Use mocker everywhere in integration tests

Replace all uses of unittest.mock, monkeypatch fixture, and the custom
mock_function fixture with the mocker fixture from pytest-mock.

* Use mocker for mock_function fixture

* Use non-string type annotations for Mock

* Prefer mocker.patch over mocker.patch.object

* Apply suggestions from code review

Co-authored-by: Jakub Fidler <[email protected]>

* Fix variable name typos (mesaage -> message)

* Remove unused mock_function fixture

---------

Co-authored-by: Jakub Fidler <[email protected]>

---------

Co-authored-by: Trey Hunner <[email protected]>
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