diff --git a/spotipy/client.py b/spotipy/client.py index d28b191..eeccd22 100644 --- a/spotipy/client.py +++ b/spotipy/client.py @@ -168,7 +168,6 @@ class Spotify(object): else: # Use the Requests API module as a "session". self._session = requests.api - def __del__(self): """Make sure the connection (pool) gets closed""" if isinstance(self._session, requests.Session): diff --git a/spotipy/oauth2.py b/spotipy/oauth2.py index 83c3daa..74292fc 100644 --- a/spotipy/oauth2.py +++ b/spotipy/oauth2.py @@ -12,7 +12,6 @@ import base64 import logging import os import time -import warnings import webbrowser import requests diff --git a/spotipy/util.py b/spotipy/util.py index ad30ac9..eec44ae 100644 --- a/spotipy/util.py +++ b/spotipy/util.py @@ -5,9 +5,6 @@ __all__ = ["CLIENT_CREDS_ENV_VARS"] import logging -import os -import warnings -import spotipy LOGGER = logging.getLogger(__name__) @@ -18,6 +15,7 @@ CLIENT_CREDS_ENV_VARS = { "redirect_uri": "SPOTIPY_REDIRECT_URI", } + def get_host_port(netloc): if ":" in netloc: host, port = netloc.split(":", 1) diff --git a/tests/integration/test_user_endpoints.py b/tests/integration/test_user_endpoints.py index 1907d07..76d8889 100644 --- a/tests/integration/test_user_endpoints.py +++ b/tests/integration/test_user_endpoints.py @@ -11,6 +11,7 @@ from spotipy import ( import unittest from tests import helpers + def _make_spotify(scopes=None, retries=None): retries = retries or Spotify.max_retries @@ -27,6 +28,7 @@ def _make_spotify(scopes=None, retries=None): return spotify + class SpotipyPlaylistApiTest(unittest.TestCase): @classmethod def setUpClass(cls): @@ -66,7 +68,6 @@ class SpotipyPlaylistApiTest(unittest.TestCase): cls.spotify = _make_spotify(scopes=scope) cls.spotify_no_retry = _make_spotify(scopes=scope, retries=0) - cls.new_playlist_name = 'spotipy-playlist-test' cls.new_playlist = helpers.get_spotify_playlist( cls.spotify, cls.new_playlist_name, cls.username) or \ diff --git a/tests/unit/test_oauth.py b/tests/unit/test_oauth.py index a196b5c..3017767 100644 --- a/tests/unit/test_oauth.py +++ b/tests/unit/test_oauth.py @@ -6,10 +6,9 @@ import unittest import six.moves.urllib.parse as urllibparse from spotipy import SpotifyOAuth, SpotifyPKCE -from spotipy.cache_handler import CacheHandler from spotipy.oauth2 import SpotifyClientCredentials, SpotifyOauthError from spotipy.oauth2 import SpotifyStateError -from spotipy import CacheFileHandler +from spotipy import MemoryCacheHandler, CacheFileHandler try: import unittest.mock as mock @@ -233,6 +232,7 @@ class TestSpotifyClientCredentials(unittest.TestCase): oauth.get_access_token() self.assertEqual(error.exception.error, 'invalid_client') + class SpotifyPKCECacheTest(unittest.TestCase): @patch.multiple(SpotifyPKCE,