Add feature: Time delta between uplift request and merge day
Added time delta between uplift request and merge day, refactored code from (https://github.com/mozilla/bugbug/pull/1917).
The next step would be adding tests in test_bug_features.py, but since this part uses bugzilla.get_landing_comments it's not easy to create a local test json file though pytest.fixture.
Let me know what test data should I use for adding tests or current test is fine.
Thanks for the suggestion @suhaibmujahid , Corrected code and added tests. I am not sure if get_bugs() is definitive (yields same number of bugs over time) so I extracted 2 samples from get_bugs(), then put it into fixtures, this should help reducing randomness.
Additionally, as this feature returns float, I added a helper function read_approx similar to read, but can handle float comparisons.
I would also like to ask, what does each bug["status"] represents, I wonder if I can find documents regarding this field.
Thank you, @3qiu!
I am not sure if get_bugs() is definitive (yields same number of bugs over time) so I extracted 2 samples from get_bugs(), then put it into fixtures, this should help reducing randomness.
It should be safe to use get_bugs() in tests. The returned data will be a mockup, and it is coming from tests/fixtures/bugs.json.
Additionally, as this feature returns float, I added a helper function
read_approxsimilar toread, but can handle float comparisons.
I do not think we have a special function to handle float. Where needed, we could wrap the value with approx().
I would also like to ask, what does each bug["status"] represents, I wonder if I can find documents regarding this field.
This represents whether the bug is closed, resolved, assigned, etc... You can see that in Bugzilla Advanced Search.
The following resources could be helpful to know more about bug fields:
- https://bmo.readthedocs.io/en/latest/api/core/v1/bug.html
- https://wiki.mozilla.org/BMO/UserGuide/BugFields
Thanks @suhaibmujahid ! I've updated the code to wrap the numbers with pytest.approx(), it should be good now.