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: use patching instead of permanently overwriting names of other modules #153

Merged
merged 4 commits into from
Oct 25, 2024

Conversation

jnussbaum
Copy link
Collaborator

@jnussbaum jnussbaum commented Oct 25, 2024

The currently used construct is problematic: doap_set.create_doap_from_admin_route_response = Mock() permanently overwrites that name in the other module. This can cause subsequent tests to fail unexpectedly, which is difficult to debug.
Instead, https://docs.python.org/3/library/unittest.mock.html#unittest.mock.patch should be used to patch names of other modules temporarily.

@jnussbaum jnussbaum self-assigned this Oct 25, 2024
@jnussbaum jnussbaum merged commit 19fbef8 into main Oct 25, 2024
1 check passed
@jnussbaum jnussbaum deleted the wip/patch-instead-of-permanent-overwrite branch October 25, 2024 09:43
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.

1 participant