[GH-ISSUE #256] Tests broken? #139

Closed
opened 2026-02-27 23:21:02 +03:00 by kerem · 2 comments
Owner

Originally created by @sr-murthy on GitHub (Feb 17, 2018).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/256

I'm trying to run the tests (tests/tests.py) but they appear to be broken - the failed ones all report the following exception

SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/search?q=weezer+pinkerton&limit=10&type=album&offset=0:
 No token provided

Here is the complete output from running this test suite.

(venv) [/path/to/my/spotipy/tests]$ python -m unittest -v tests > ../tests-output-Feb-17-2018.txt
test_album_search (tests.TestSpotipy) ... ERROR
test_album_tracks (tests.TestSpotipy) ... ERROR
test_album_tracks_many (tests.TestSpotipy) ... ERROR
test_album_urn (tests.TestSpotipy) ... ERROR
test_albums (tests.TestSpotipy) ... ERROR
test_artist_albums (tests.TestSpotipy) ... ERROR
test_artist_related_artists (tests.TestSpotipy) ... ERROR
test_artist_search (tests.TestSpotipy) ... ERROR
test_artist_search_with_market (tests.TestSpotipy) ... ERROR
test_artist_top_tracks (tests.TestSpotipy) ... ERROR
test_artist_urn (tests.TestSpotipy) ... ERROR
test_artists (tests.TestSpotipy) ... ERROR
test_custom_requests_session (tests.TestSpotipy) ... ERROR
test_force_no_requests_session (tests.TestSpotipy) ... ERROR
test_search_timeout (tests.TestSpotipy) ... ERROR
test_track_bad_id (tests.TestSpotipy) ... ok
test_track_bad_urn (tests.TestSpotipy) ... ok
test_track_id (tests.TestSpotipy) ... ERROR
test_track_search (tests.TestSpotipy) ... ERROR
test_track_url (tests.TestSpotipy) ... ERROR
test_track_urn (tests.TestSpotipy) ... ERROR
test_tracks (tests.TestSpotipy) ... ERROR
test_unauthenticated_post_fails (tests.TestSpotipy) ... ok
test_user (tests.TestSpotipy) ... ERROR

======================================================================
ERROR: test_album_search (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 141, in test_album_search
    results = self.spotify.search(q='weezer pinkerton', type='album')
  File "/path/to/my/spotipy/spotipy/client.py", line 349, in search
    return self._get('search', q=q, limit=limit, offset=offset, type=type, market=market)
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/search?q=weezer+pinkerton&limit=10&type=album&offset=0:
 No token provided

======================================================================
ERROR: test_album_tracks (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 50, in test_album_tracks
    results = self.spotify.album_tracks(self.pinkerton_urn)
  File "/path/to/my/spotipy/spotipy/client.py", line 326, in album_tracks
    offset=offset)
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/albums/04xe676vyiTeYNXw15o9jT/tracks/?limit=50&offset=0:
 No token provided

======================================================================
ERROR: test_album_tracks_many (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 54, in test_album_tracks_many
    results = self.spotify.album_tracks(self.angeles_haydn_urn)
  File "/path/to/my/spotipy/spotipy/client.py", line 326, in album_tracks
    offset=offset)
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/albums/1vAbqAeuJVWNAe7UR00bdM/tracks/?limit=50&offset=0:
 No token provided

======================================================================
ERROR: test_album_urn (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 46, in test_album_urn
    album = self.spotify.album(self.pinkerton_urn)
  File "/path/to/my/spotipy/spotipy/client.py", line 313, in album
    return self._get('albums/' + trid)
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/albums/04xe676vyiTeYNXw15o9jT:
 No token provided

======================================================================
ERROR: test_albums (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 65, in test_albums
    results = self.spotify.albums([self.pinkerton_urn, self.pablo_honey_urn])
  File "/path/to/my/spotipy/spotipy/client.py", line 336, in albums
    return self._get('albums/?ids=' + ','.join(tlist))
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/albums/?ids=04xe676vyiTeYNXw15o9jT,6AZv3m27uyRxi8KyJSfUxL:
 No token provided

======================================================================
ERROR: test_artist_albums (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 120, in test_artist_albums
    results = self.spotify.artist_albums(self.weezer_urn)
  File "/path/to/my/spotipy/spotipy/client.py", line 280, in artist_albums
    country=country, limit=limit, offset=offset)
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/artists/3jOstUTkEu2JkjvRdBA5Gu/albums?limit=20&offset=0:
 No token provided

======================================================================
ERROR: test_artist_related_artists (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 99, in test_artist_related_artists
    results = self.spotify.artist_related_artists(self.weezer_urn)
  File "/path/to/my/spotipy/spotipy/client.py", line 303, in artist_related_artists
    return self._get('artists/' + trid + '/related-artists')
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/artists/3jOstUTkEu2JkjvRdBA5Gu/related-artists:
 No token provided

======================================================================
ERROR: test_artist_search (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 108, in test_artist_search
    results = self.spotify.search(q='weezer', type='artist')
  File "/path/to/my/spotipy/spotipy/client.py", line 349, in search
    return self._get('search', q=q, limit=limit, offset=offset, type=type, market=market)
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/search?q=weezer&limit=10&type=artist&offset=0:
 No token provided

======================================================================
ERROR: test_artist_search_with_market (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 114, in test_artist_search_with_market
    results = self.spotify.search(q='weezer', type='artist', market='GB')
  File "/path/to/my/spotipy/spotipy/client.py", line 349, in search
    return self._get('search', q=q, limit=limit, offset=offset, type=type, market=market)
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/search?q=weezer&limit=10&type=artist&market=GB&offset=0:
 No token provided

======================================================================
ERROR: test_artist_top_tracks (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 94, in test_artist_top_tracks
    results = self.spotify.artist_top_tracks(self.weezer_urn)
  File "/path/to/my/spotipy/spotipy/client.py", line 292, in artist_top_tracks
    return self._get('artists/' + trid + '/top-tracks', country=country)
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/artists/3jOstUTkEu2JkjvRdBA5Gu/top-tracks?country=US:
 No token provided

======================================================================
ERROR: test_artist_urn (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 37, in test_artist_urn
    artist = self.spotify.artist(self.radiohead_urn)
  File "/path/to/my/spotipy/spotipy/client.py", line 254, in artist
    return self._get('artists/' + trid)
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/artists/4Z8W4fKeB5YxbusRsdQVPb:
 No token provided

======================================================================
ERROR: test_artists (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 41, in test_artists
    results = self.spotify.artists([self.weezer_urn, self.radiohead_urn])
  File "/path/to/my/spotipy/spotipy/client.py", line 264, in artists
    return self._get('artists/?ids=' + ','.join(tlist))
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/artists/?ids=3jOstUTkEu2JkjvRdBA5Gu,4Z8W4fKeB5YxbusRsdQVPb:
 No token provided

======================================================================
ERROR: test_custom_requests_session (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 181, in test_custom_requests_session
    self.assertTrue(with_custom_session.user(user="akx")["uri"] == "spotify:user:akx")
  File "/path/to/my/spotipy/spotipy/client.py", line 357, in user
    return self._get('users/' + user)
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/users/akx:
 No token provided

======================================================================
ERROR: test_force_no_requests_session (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 187, in test_force_no_requests_session
    self.assertTrue(with_no_session.user(user="akx")["uri"] == "spotify:user:akx")
  File "/path/to/my/spotipy/spotipy/client.py", line 357, in user
    return self._get('users/' + user)
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/users/akx:
 No token provided

======================================================================
ERROR: test_search_timeout (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 136, in test_search_timeout
    except requests.ReadTimeout:
AttributeError: 'module' object has no attribute 'ReadTimeout'

======================================================================
ERROR: test_track_id (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 74, in test_track_id
    track = self.spotify.track(self.creep_id)
  File "/path/to/my/spotipy/spotipy/client.py", line 233, in track
    return self._get('tracks/' + trid)
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/tracks/3HfB5hBU0dmBt8T0iCmH42:
 No token provided

======================================================================
ERROR: test_track_search (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 147, in test_track_search
    results = self.spotify.search(q='el scorcho weezer', type='track')
  File "/path/to/my/spotipy/spotipy/client.py", line 349, in search
    return self._get('search', q=q, limit=limit, offset=offset, type=type, market=market)
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/search?q=el+scorcho+weezer&limit=10&type=track&offset=0:
 No token provided

======================================================================
ERROR: test_track_url (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 78, in test_track_url
    track = self.spotify.track(self.creep_url)
  File "/path/to/my/spotipy/spotipy/client.py", line 233, in track
    return self._get('tracks/' + trid)
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/tracks/3HfB5hBU0dmBt8T0iCmH42:
 No token provided

======================================================================
ERROR: test_track_urn (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 70, in test_track_urn
    track = self.spotify.track(self.creep_urn)
  File "/path/to/my/spotipy/spotipy/client.py", line 233, in track
    return self._get('tracks/' + trid)
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/tracks/3HfB5hBU0dmBt8T0iCmH42:
 No token provided

======================================================================
ERROR: test_tracks (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 89, in test_tracks
    results = self.spotify.tracks([self.creep_url, self.el_scorcho_urn])
  File "/path/to/my/spotipy/spotipy/client.py", line 244, in tracks
    return self._get('tracks/?ids=' + ','.join(tlist), market = market)
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/tracks/?ids=3HfB5hBU0dmBt8T0iCmH42,0Svkvt5I79wficMFgaqEQJ:
 No token provided

======================================================================
ERROR: test_user (tests.TestSpotipy)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 153, in test_user
    user = self.spotify.user(user='plamere')
  File "/path/to/my/spotipy/spotipy/client.py", line 357, in user
    return self._get('users/' + user)
  File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call
    headers=r.headers)
SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/users/plamere:
 No token provided

----------------------------------------------------------------------
Ran 24 tests in 5.625s

FAILED (errors=21)
Originally created by @sr-murthy on GitHub (Feb 17, 2018). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/256 I'm trying to run the tests (`tests/tests.py`) but they appear to be broken - the failed ones all report the following exception SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/search?q=weezer+pinkerton&limit=10&type=album&offset=0: No token provided Here is the complete output from running this test suite. (venv) [/path/to/my/spotipy/tests]$ python -m unittest -v tests > ../tests-output-Feb-17-2018.txt test_album_search (tests.TestSpotipy) ... ERROR test_album_tracks (tests.TestSpotipy) ... ERROR test_album_tracks_many (tests.TestSpotipy) ... ERROR test_album_urn (tests.TestSpotipy) ... ERROR test_albums (tests.TestSpotipy) ... ERROR test_artist_albums (tests.TestSpotipy) ... ERROR test_artist_related_artists (tests.TestSpotipy) ... ERROR test_artist_search (tests.TestSpotipy) ... ERROR test_artist_search_with_market (tests.TestSpotipy) ... ERROR test_artist_top_tracks (tests.TestSpotipy) ... ERROR test_artist_urn (tests.TestSpotipy) ... ERROR test_artists (tests.TestSpotipy) ... ERROR test_custom_requests_session (tests.TestSpotipy) ... ERROR test_force_no_requests_session (tests.TestSpotipy) ... ERROR test_search_timeout (tests.TestSpotipy) ... ERROR test_track_bad_id (tests.TestSpotipy) ... ok test_track_bad_urn (tests.TestSpotipy) ... ok test_track_id (tests.TestSpotipy) ... ERROR test_track_search (tests.TestSpotipy) ... ERROR test_track_url (tests.TestSpotipy) ... ERROR test_track_urn (tests.TestSpotipy) ... ERROR test_tracks (tests.TestSpotipy) ... ERROR test_unauthenticated_post_fails (tests.TestSpotipy) ... ok test_user (tests.TestSpotipy) ... ERROR ====================================================================== ERROR: test_album_search (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 141, in test_album_search results = self.spotify.search(q='weezer pinkerton', type='album') File "/path/to/my/spotipy/spotipy/client.py", line 349, in search return self._get('search', q=q, limit=limit, offset=offset, type=type, market=market) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/search?q=weezer+pinkerton&limit=10&type=album&offset=0: No token provided ====================================================================== ERROR: test_album_tracks (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 50, in test_album_tracks results = self.spotify.album_tracks(self.pinkerton_urn) File "/path/to/my/spotipy/spotipy/client.py", line 326, in album_tracks offset=offset) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/albums/04xe676vyiTeYNXw15o9jT/tracks/?limit=50&offset=0: No token provided ====================================================================== ERROR: test_album_tracks_many (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 54, in test_album_tracks_many results = self.spotify.album_tracks(self.angeles_haydn_urn) File "/path/to/my/spotipy/spotipy/client.py", line 326, in album_tracks offset=offset) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/albums/1vAbqAeuJVWNAe7UR00bdM/tracks/?limit=50&offset=0: No token provided ====================================================================== ERROR: test_album_urn (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 46, in test_album_urn album = self.spotify.album(self.pinkerton_urn) File "/path/to/my/spotipy/spotipy/client.py", line 313, in album return self._get('albums/' + trid) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/albums/04xe676vyiTeYNXw15o9jT: No token provided ====================================================================== ERROR: test_albums (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 65, in test_albums results = self.spotify.albums([self.pinkerton_urn, self.pablo_honey_urn]) File "/path/to/my/spotipy/spotipy/client.py", line 336, in albums return self._get('albums/?ids=' + ','.join(tlist)) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/albums/?ids=04xe676vyiTeYNXw15o9jT,6AZv3m27uyRxi8KyJSfUxL: No token provided ====================================================================== ERROR: test_artist_albums (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 120, in test_artist_albums results = self.spotify.artist_albums(self.weezer_urn) File "/path/to/my/spotipy/spotipy/client.py", line 280, in artist_albums country=country, limit=limit, offset=offset) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/artists/3jOstUTkEu2JkjvRdBA5Gu/albums?limit=20&offset=0: No token provided ====================================================================== ERROR: test_artist_related_artists (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 99, in test_artist_related_artists results = self.spotify.artist_related_artists(self.weezer_urn) File "/path/to/my/spotipy/spotipy/client.py", line 303, in artist_related_artists return self._get('artists/' + trid + '/related-artists') File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/artists/3jOstUTkEu2JkjvRdBA5Gu/related-artists: No token provided ====================================================================== ERROR: test_artist_search (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 108, in test_artist_search results = self.spotify.search(q='weezer', type='artist') File "/path/to/my/spotipy/spotipy/client.py", line 349, in search return self._get('search', q=q, limit=limit, offset=offset, type=type, market=market) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/search?q=weezer&limit=10&type=artist&offset=0: No token provided ====================================================================== ERROR: test_artist_search_with_market (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 114, in test_artist_search_with_market results = self.spotify.search(q='weezer', type='artist', market='GB') File "/path/to/my/spotipy/spotipy/client.py", line 349, in search return self._get('search', q=q, limit=limit, offset=offset, type=type, market=market) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/search?q=weezer&limit=10&type=artist&market=GB&offset=0: No token provided ====================================================================== ERROR: test_artist_top_tracks (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 94, in test_artist_top_tracks results = self.spotify.artist_top_tracks(self.weezer_urn) File "/path/to/my/spotipy/spotipy/client.py", line 292, in artist_top_tracks return self._get('artists/' + trid + '/top-tracks', country=country) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/artists/3jOstUTkEu2JkjvRdBA5Gu/top-tracks?country=US: No token provided ====================================================================== ERROR: test_artist_urn (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 37, in test_artist_urn artist = self.spotify.artist(self.radiohead_urn) File "/path/to/my/spotipy/spotipy/client.py", line 254, in artist return self._get('artists/' + trid) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/artists/4Z8W4fKeB5YxbusRsdQVPb: No token provided ====================================================================== ERROR: test_artists (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 41, in test_artists results = self.spotify.artists([self.weezer_urn, self.radiohead_urn]) File "/path/to/my/spotipy/spotipy/client.py", line 264, in artists return self._get('artists/?ids=' + ','.join(tlist)) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/artists/?ids=3jOstUTkEu2JkjvRdBA5Gu,4Z8W4fKeB5YxbusRsdQVPb: No token provided ====================================================================== ERROR: test_custom_requests_session (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 181, in test_custom_requests_session self.assertTrue(with_custom_session.user(user="akx")["uri"] == "spotify:user:akx") File "/path/to/my/spotipy/spotipy/client.py", line 357, in user return self._get('users/' + user) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/users/akx: No token provided ====================================================================== ERROR: test_force_no_requests_session (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 187, in test_force_no_requests_session self.assertTrue(with_no_session.user(user="akx")["uri"] == "spotify:user:akx") File "/path/to/my/spotipy/spotipy/client.py", line 357, in user return self._get('users/' + user) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/users/akx: No token provided ====================================================================== ERROR: test_search_timeout (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 136, in test_search_timeout except requests.ReadTimeout: AttributeError: 'module' object has no attribute 'ReadTimeout' ====================================================================== ERROR: test_track_id (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 74, in test_track_id track = self.spotify.track(self.creep_id) File "/path/to/my/spotipy/spotipy/client.py", line 233, in track return self._get('tracks/' + trid) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/tracks/3HfB5hBU0dmBt8T0iCmH42: No token provided ====================================================================== ERROR: test_track_search (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 147, in test_track_search results = self.spotify.search(q='el scorcho weezer', type='track') File "/path/to/my/spotipy/spotipy/client.py", line 349, in search return self._get('search', q=q, limit=limit, offset=offset, type=type, market=market) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/search?q=el+scorcho+weezer&limit=10&type=track&offset=0: No token provided ====================================================================== ERROR: test_track_url (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 78, in test_track_url track = self.spotify.track(self.creep_url) File "/path/to/my/spotipy/spotipy/client.py", line 233, in track return self._get('tracks/' + trid) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/tracks/3HfB5hBU0dmBt8T0iCmH42: No token provided ====================================================================== ERROR: test_track_urn (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 70, in test_track_urn track = self.spotify.track(self.creep_urn) File "/path/to/my/spotipy/spotipy/client.py", line 233, in track return self._get('tracks/' + trid) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/tracks/3HfB5hBU0dmBt8T0iCmH42: No token provided ====================================================================== ERROR: test_tracks (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 89, in test_tracks results = self.spotify.tracks([self.creep_url, self.el_scorcho_urn]) File "/path/to/my/spotipy/spotipy/client.py", line 244, in tracks return self._get('tracks/?ids=' + ','.join(tlist), market = market) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/tracks/?ids=3HfB5hBU0dmBt8T0iCmH42,0Svkvt5I79wficMFgaqEQJ: No token provided ====================================================================== ERROR: test_user (tests.TestSpotipy) ---------------------------------------------------------------------- Traceback (most recent call last): File "tests.py", line 153, in test_user user = self.spotify.user(user='plamere') File "/path/to/my/spotipy/spotipy/client.py", line 357, in user return self._get('users/' + user) File "/path/to/my/spotipy/spotipy/client.py", line 153, in _get return self._internal_call('GET', url, payload, kwargs) File "/path/to/my/spotipy/spotipy/client.py", line 131, in _internal_call headers=r.headers) SpotifyException: http status: 401, code:-1 - https://api.spotify.com/v1/users/plamere: No token provided ---------------------------------------------------------------------- Ran 24 tests in 5.625s FAILED (errors=21)
kerem closed this issue 2026-02-27 23:21:03 +03:00
Author
Owner

@sr-murthy commented on GitHub (Feb 17, 2018):

At the moment if you try to run tests/tests.py from its current location it fails because it cannot import the spotify module, which is at base of the repository. You have to import os, sys, and then do a sys.path.insert(0, os.path.abspath(os.pardir)) in tests.py.

<!-- gh-comment-id:366435932 --> @sr-murthy commented on GitHub (Feb 17, 2018): At the moment if you try to run `tests/tests.py` from its current location it fails because it cannot import the `spotify` module, which is at base of the repository. You have to import `os`, `sys`, and then do a `sys.path.insert(0, os.path.abspath(os.pardir))` in `tests.py`.
Author
Owner

@sr-murthy commented on GitHub (Feb 17, 2018):

OK, so I was just missing the API client credentials. I was able to run and pass all these tests.

$ python -m unittest -v tests
test_album_search (tests.TestSpotipy) ... ok
test_album_tracks (tests.TestSpotipy) ... ok
test_album_tracks_many (tests.TestSpotipy) ... ok
test_album_urn (tests.TestSpotipy) ... ok
test_albums (tests.TestSpotipy) ... ok
test_artist_albums (tests.TestSpotipy) ... ok
test_artist_related_artists (tests.TestSpotipy) ... ok
test_artist_search (tests.TestSpotipy) ... ok
test_artist_search_with_market (tests.TestSpotipy) ... ok
test_artist_top_tracks (tests.TestSpotipy) ... ok
test_artist_urn (tests.TestSpotipy) ... ok
test_artists (tests.TestSpotipy) ... ok
test_custom_requests_session (tests.TestSpotipy) ... ok
test_force_no_requests_session (tests.TestSpotipy) ... ok
test_search_timeout (tests.TestSpotipy) ... ok
test_track_bad_id (tests.TestSpotipy) ... ok
test_track_bad_urn (tests.TestSpotipy) ... ok
test_track_id (tests.TestSpotipy) ... ok
test_track_search (tests.TestSpotipy) ... ok
test_track_url (tests.TestSpotipy) ... ok
test_track_urn (tests.TestSpotipy) ... ok
test_tracks (tests.TestSpotipy) ... ok
test_unauthenticated_post_fails (tests.TestSpotipy) ... ok
test_user (tests.TestSpotipy) ... ok

----------------------------------------------------------------------
Ran 24 tests in 3.392s

OK
<!-- gh-comment-id:366447987 --> @sr-murthy commented on GitHub (Feb 17, 2018): OK, so I was just missing the API client credentials. I was able to run and pass all these tests. $ python -m unittest -v tests test_album_search (tests.TestSpotipy) ... ok test_album_tracks (tests.TestSpotipy) ... ok test_album_tracks_many (tests.TestSpotipy) ... ok test_album_urn (tests.TestSpotipy) ... ok test_albums (tests.TestSpotipy) ... ok test_artist_albums (tests.TestSpotipy) ... ok test_artist_related_artists (tests.TestSpotipy) ... ok test_artist_search (tests.TestSpotipy) ... ok test_artist_search_with_market (tests.TestSpotipy) ... ok test_artist_top_tracks (tests.TestSpotipy) ... ok test_artist_urn (tests.TestSpotipy) ... ok test_artists (tests.TestSpotipy) ... ok test_custom_requests_session (tests.TestSpotipy) ... ok test_force_no_requests_session (tests.TestSpotipy) ... ok test_search_timeout (tests.TestSpotipy) ... ok test_track_bad_id (tests.TestSpotipy) ... ok test_track_bad_urn (tests.TestSpotipy) ... ok test_track_id (tests.TestSpotipy) ... ok test_track_search (tests.TestSpotipy) ... ok test_track_url (tests.TestSpotipy) ... ok test_track_urn (tests.TestSpotipy) ... ok test_tracks (tests.TestSpotipy) ... ok test_unauthenticated_post_fails (tests.TestSpotipy) ... ok test_user (tests.TestSpotipy) ... ok ---------------------------------------------------------------------- Ran 24 tests in 3.392s OK
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#139
No description provided.