[GH-ISSUE #678] Running tests with unaltered code results in errors #400

Closed
opened 2026-02-27 23:22:25 +03:00 by kerem · 6 comments
Owner

Originally created by @gustavokrieger on GitHub (Apr 22, 2021).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/678

Originally assigned to: @stephanebruckert on GitHub.

Describe the bug
Running tests in master results in 7 errors.

Your code
python -m unittest discover -v tests

Expected behavior
All tests ran correctly.

Output

The ones that failed:

======================================================================
FAIL: test_max_retries_reached_get (integration.test_non_user_endpoints.AuthTestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/gustavokrieger/PycharmProjects/spotipy/tests/integration/test_non_user_endpoints.py", line 256, in test_max_retries_reached_get
    self.fail()
AssertionError: None

======================================================================
FAIL: test_current_user_follows (integration.test_user_endpoints.SpotipyFollowApiTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/gustavokrieger/PycharmProjects/spotipy/tests/integration/test_user_endpoints.py", line 393, in test_current_user_follows
    self.assertGreater(len(artists['items']), 0)
AssertionError: 0 not greater than 0

======================================================================
FAIL: test_current_user_saved_tracks (integration.test_user_endpoints.SpotipyLibraryApiTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/gustavokrieger/PycharmProjects/spotipy/tests/integration/test_user_endpoints.py", line 242, in test_current_user_saved_tracks
    self.assertGreater(len(tracks['items']), 0)
AssertionError: 0 not greater than 0

======================================================================
FAIL: test_devices (integration.test_user_endpoints.SpotipyPlayerApiTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/gustavokrieger/PycharmProjects/spotipy/tests/integration/test_user_endpoints.py", line 448, in test_devices
    self.assertEqual(len(res["devices"]), 0)
AssertionError: 1 != 0

======================================================================
FAIL: test_max_retries_reached_post (integration.test_user_endpoints.SpotipyPlaylistApiTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/gustavokrieger/PycharmProjects/spotipy/tests/integration/test_user_endpoints.py", line 132, in test_max_retries_reached_post
    self.fail()
AssertionError: None

======================================================================
FAIL: test_current_user_top_tracks (integration.test_user_endpoints.SpotipyUserApiTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/gustavokrieger/PycharmProjects/spotipy/tests/integration/test_user_endpoints.py", line 327, in test_current_user_top_tracks
    self.assertGreater(len(items), 0)
AssertionError: 0 not greater than 0

======================================================================
FAIL: test_spotify_client_credentials_get_access_token (unit.test_oauth.TestSpotifyClientCredentials)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/gustavokrieger/PycharmProjects/spotipy/tests/unit/test_oauth.py", line 248, in test_spotify_client_credentials_get_access_token
    oauth.get_access_token()
AssertionError: SpotifyOauthError not raised

----------------------------------------------------------------------
Ran 116 tests in 214.537s

FAILED (failures=7)

Environment:

  • OS: macOS Big Sur 11.2.3
  • Python version: 3.7.10
  • spotipy version: current master

Additional context
I want to look into it, but before starting I want to make sure I'm not missing something.
The Spotify account I'm using is not Premium. It is also new, so it is completely empty in terms of liked songs, playlists, etc. It looks like some errors have something to do with this, is it expected behaviour?

Originally created by @gustavokrieger on GitHub (Apr 22, 2021). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/678 Originally assigned to: @stephanebruckert on GitHub. **Describe the bug** Running tests in master results in 7 errors. **Your code** `python -m unittest discover -v tests` **Expected behavior** All tests ran correctly. **Output** The ones that failed: ``` ====================================================================== FAIL: test_max_retries_reached_get (integration.test_non_user_endpoints.AuthTestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/gustavokrieger/PycharmProjects/spotipy/tests/integration/test_non_user_endpoints.py", line 256, in test_max_retries_reached_get self.fail() AssertionError: None ====================================================================== FAIL: test_current_user_follows (integration.test_user_endpoints.SpotipyFollowApiTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/gustavokrieger/PycharmProjects/spotipy/tests/integration/test_user_endpoints.py", line 393, in test_current_user_follows self.assertGreater(len(artists['items']), 0) AssertionError: 0 not greater than 0 ====================================================================== FAIL: test_current_user_saved_tracks (integration.test_user_endpoints.SpotipyLibraryApiTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/gustavokrieger/PycharmProjects/spotipy/tests/integration/test_user_endpoints.py", line 242, in test_current_user_saved_tracks self.assertGreater(len(tracks['items']), 0) AssertionError: 0 not greater than 0 ====================================================================== FAIL: test_devices (integration.test_user_endpoints.SpotipyPlayerApiTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/gustavokrieger/PycharmProjects/spotipy/tests/integration/test_user_endpoints.py", line 448, in test_devices self.assertEqual(len(res["devices"]), 0) AssertionError: 1 != 0 ====================================================================== FAIL: test_max_retries_reached_post (integration.test_user_endpoints.SpotipyPlaylistApiTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/gustavokrieger/PycharmProjects/spotipy/tests/integration/test_user_endpoints.py", line 132, in test_max_retries_reached_post self.fail() AssertionError: None ====================================================================== FAIL: test_current_user_top_tracks (integration.test_user_endpoints.SpotipyUserApiTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/gustavokrieger/PycharmProjects/spotipy/tests/integration/test_user_endpoints.py", line 327, in test_current_user_top_tracks self.assertGreater(len(items), 0) AssertionError: 0 not greater than 0 ====================================================================== FAIL: test_spotify_client_credentials_get_access_token (unit.test_oauth.TestSpotifyClientCredentials) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/gustavokrieger/PycharmProjects/spotipy/tests/unit/test_oauth.py", line 248, in test_spotify_client_credentials_get_access_token oauth.get_access_token() AssertionError: SpotifyOauthError not raised ---------------------------------------------------------------------- Ran 116 tests in 214.537s FAILED (failures=7) ``` **Environment:** - OS: macOS Big Sur 11.2.3 - Python version: 3.7.10 - spotipy version: current master **Additional context** I want to look into it, but before starting I want to make sure I'm not missing something. The Spotify account I'm using is not Premium. It is also new, so it is completely empty in terms of liked songs, playlists, etc. It looks like some errors have something to do with this, is it expected behaviour?
kerem 2026-02-27 23:22:25 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@stephanebruckert commented on GitHub (Apr 22, 2021):

Yes.

Integration tests should:

  • work from an empty account or from any account after initialising what is needed,
  • run on the CI (as part of a github action).

I plan to work on these ASAP

<!-- gh-comment-id:825169746 --> @stephanebruckert commented on GitHub (Apr 22, 2021): Yes. Integration tests should: - work from an empty account or from any account after initialising what is needed, - run on the CI (as part of a github action). I plan to work on these ASAP
Author
Owner

@gustavokrieger commented on GitHub (Apr 22, 2021):

Mind if I try my hand on these:

  • test_current_user_follows

  • test_current_user_saved_tracks

  • test_current_user_top_tracks

They probably happen because of the empty account.

<!-- gh-comment-id:825179571 --> @gustavokrieger commented on GitHub (Apr 22, 2021): Mind if I try my hand on these: - test_current_user_follows - test_current_user_saved_tracks - test_current_user_top_tracks They probably happen because of the empty account.
Author
Owner

@gustavokrieger commented on GitHub (Apr 22, 2021):

I created a Pull Request for these - #679

<!-- gh-comment-id:825267664 --> @gustavokrieger commented on GitHub (Apr 22, 2021): I created a Pull Request for [these](https://github.com/plamere/spotipy/issues/678#issuecomment-825179571) - #679
Author
Owner

@Peter-Schorn commented on GitHub (Apr 23, 2021):

The reason the failure of test_max_retries_reached_get is probably because Spotify has a very high rate limit. You can make at least several requests per second. If your internet connection is slow, then serial requests may never exceed the limit.

<!-- gh-comment-id:825385412 --> @Peter-Schorn commented on GitHub (Apr 23, 2021): The reason the failure of `test_max_retries_reached_get` is probably because Spotify has a very high rate limit. You can make at least several requests per second. If your internet connection is slow, then serial requests may never exceed the limit.
Author
Owner

@gustavokrieger commented on GitHub (Apr 24, 2021):

I created a pull Pull Request to solve test_spotify_client_credentials_get_access_token - #682

<!-- gh-comment-id:826133536 --> @gustavokrieger commented on GitHub (Apr 24, 2021): I created a pull Pull Request to solve `test_spotify_client_credentials_get_access_token` - #682
Author
Owner

@stephanebruckert commented on GitHub (Jul 9, 2024):

Closing, PR was merged

<!-- gh-comment-id:2218379401 --> @stephanebruckert commented on GitHub (Jul 9, 2024): Closing, PR was merged
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#400
No description provided.