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

refactor(warnings): rework MiscalledStubWarning checker for clarity #219

Merged
merged 1 commit into from
Aug 13, 2023

Conversation

mcous
Copy link
Owner

@mcous mcous commented Aug 13, 2023

#204 raised a couple questions about when Decoy chooses to emit errors and warnings, one of which is addressed by #218. The second question asks:

[Should Decoy complain if] we try calling a method that is part of the mocked spec which is not mocked?

Currently, Decoy will not complain in this scenario. It will issue a MiscalledStubWarning if and only if the mock in question is used at least once with decoy.when, which acts as a marker for a test to say "I care about this dependency". This PR comes out of an investigation into the feasibility of enabling a MiscalledStubWarning even if the mock is fully unconfigured. In the course of answering this question:

  • I reworked this portion of the warning checker
  • I decided the answer is still no

Issuing a warning in this case forces every test using given subject to decoy.when or decoy.verify every single dependency the subject uses, even if a particular test isn't concerned with that behavior. In Decoy's own test suite this would trigger 8 warnings, and "fixing" those warnings would bloat the tests in question without providing meaningful design feedback

Copy link
Owner Author

mcous commented Aug 13, 2023

Base automatically changed from spec-method-not-found to main August 13, 2023 21:13
@codecov
Copy link

codecov bot commented Aug 13, 2023

Codecov Report

Merging #219 (fe9edf9) into main (72cefe4) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #219      +/-   ##
==========================================
+ Coverage   98.37%   98.38%   +0.01%     
==========================================
  Files          19       19              
  Lines         739      744       +5     
  Branches       88       90       +2     
==========================================
+ Hits          727      732       +5     
  Misses         10       10              
  Partials        2        2              
Files Changed Coverage Δ
decoy/warning_checker.py 100.00% <100.00%> (ø)
decoy/warnings.py 100.00% <100.00%> (ø)

@mcous mcous merged commit f2f7fcb into main Aug 13, 2023
22 checks passed
@mcous mcous deleted the refactor-call-checker branch August 13, 2023 21:18
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.

None yet

1 participant