-
Notifications
You must be signed in to change notification settings - Fork 29
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/rewrite test suite #138
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #138 +/- ##
==========================================
- Coverage 99.91% 95.47% -4.44%
==========================================
Files 14 14
Lines 1120 1171 +51
Branches 210 234 +24
==========================================
- Hits 1119 1118 -1
- Misses 0 43 +43
- Partials 1 10 +9 ☔ View full report in Codecov by Sentry. |
a350b0d
to
1cb0c82
Compare
sorry, the new tests are kindof buried in trivial changes. You probably want to look over here: This is the style I'm trying to roll out everywhere. |
@2e0byo Thanks, I will take a look at it. If the tests are more descriptive, I am sure it will help with my (and other developers) understanding. Automated tests in python is still a new topic for me but it is very nice to see an experienced python developer working on it! |
f1046cf
to
859c1cf
Compare
@tehkillerbee this rewrite is 64% complete by files and probably 75% complete by lines. Two things are still needed to hit the original goal of making the tests obvious:
I'm inclined to attack 2. first. It would be cool if we could just do Off the top of my head a slight refactor over at python-tidal (dropping I don't know what you want to do about this PR, but it's a lot of red/green to review. It might be worth just looking at the new test files and highlighting what doesn't make sense, rather than looking at the tests side-by-side. I'm happy to clarify or re-write anything which isn't clear. |
The test failures are mostly spurious:
|
Hey, good to see you've had time to work on this.
Ok I'll do as you suggest. I'll try to get it reviewed this coming week. It would be nice to get it merged, especially before next mopidy-tidal release. There hasn't been one for a while, but I am planning to release it when I have gotten Hires/HLS stream playback working. |
Thanks for your time! Sorry this PR's been open for so long... |
|
||
class TestBrowseAlbum: | ||
def test_missing_album_returns_empty_list(self, library_provider, session): | ||
session.album.side_effect = HTTPError("No such album") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might not be an HTTPError anymore after my latest tidalapi changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@2e0byo I think it looks very good, great work! I like the structure of the new tests added to test_library.py. It looks relatively easy to understand what is going on.
Only minor comments. I think we can get this merged in and then deal with the comments in a later MR.
Thanks! I'll go through after work and cleanup. |
@tehkillerbee I'd like to check that error hasn't changed upstream, then this is good to merge from my POV. |
@2e0byo If you have time, you can rebase to latest master then I will merge this PR before v0.3.5 release 👍 |
@tehkillerbee I'll get on that early next week (away till then). Sorry for the delay. |
btw |
0b017fc
to
dee7c26
Compare
Lots of tests need fixing up with the latest changes; I'll try to get to it soon. This is rebased, however. |
login=hack is broken, so if you want to release pronto you should remove it. I see there's now an AUTO method: if you get to this soon, what does that do? (else I can just read the code). We may not need the hack login if we have something better. |
@2e0byo are you sure? Login hack worked fine last time I tested, after refactoring. I tested with PKCE and Oauth. It also requires latest tidalapi from master. Auto=hack, I just added auto as an alias as it sounds more user friendly. EDIT: Just tested HACK (AUTO) again and it works fine with both PKCE and OAUTH. |
Thanks for the rebase. No rush with the tests, I'll make a branch and I'll try to take a look at the broken tests. |
oh that's a nice surprise. I didn't test, just read the code. No wonder I was wrong... Where the tests are related to changes in |
BTW if you do get round to looking at tests, I think the integration tests are the first thing to fix. They're all broken because the log output has changed, but should be very easy to fix. That would be a nice way to confirm that everything does in fact work. |
@tehkillerbee here's a start on the work of refactoring the test suite to be (i) more correct and (ii) easier to maintain.
So far I've not fixed the broken tests, but I've focused on making the current tests descriptive. This is a good exercise and led to finding a few bugs, like #137, where before I'd blindly asserted our behaviour without checking it made sense.
As well as general criticism I'd really appreciate feedback on how clear the new tests are, and how obviously they set out what they're testing. The new tests are in
test_library.py
: the rest is just cleanup.We're always going to have some 'magic', but I've taken a few steps to minimise surprises:
make_tidal_track
overtidal_tracks
) -> the test is more self-contained, and it's obvious where the data is coming fromI've also fixed a few bugs and done some refactoring.
I mean to chip away at this, but when you're happy with things feel free to merge this pr in (we might as well improve incrementally).
I mean to:
over the next few months in odd moments, so hopefully there'll be a steady drip of small PRs rather than one massive chunk.