mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[PR #257] [CLOSED] Cleanup imports, file structures and tests #834
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#834
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/spotipy-dev/spotipy/pull/257
Author: @sr-murthy
Created: 2/17/2018
Status: ❌ Closed
Base:
master← Head:cleanup-imports-and-file-structures-and-tests📝 Commits (7)
90d6622Re-order imports and specify UTF-8 encoding header in all base modules and package initialiser (ref. https://www.python.org/dev/peps/pep-0008/#imports, https://www.python.org/dev/peps/pep-0008/#source-file-encoding) + add__all__attribute5f47ae2Update spotify package initialiser8cc601fRemove relative imports inspotifypackage initialiser816dac8Miscellaneous fixes - clean up tests613d99aFurther clean up of tests578b46eRenaming some test modules:authtests.py->test_auth.py,authtests2.py->test_auth2.py,client_credential_tests.py->test_client_credentials.py+ updatetox.ini2c5d55dUpdate tests - make client credentials env. vars list a commonly accessible dictionary inspotipy/util.py📊 Changes
14 files changed (+304 additions, -156 deletions)
View changed files
📝
.gitignore(+1 -0)📝
requirements.txt(+2 -0)📝
setup.py(+1 -0)📝
spotipy/__init__.py(+4 -1)📝
spotipy/client.py(+11 -6)📝
spotipy/oauth2.py(+13 -3)📝
spotipy/util.py(+17 -1)➖
tests/client_credentials_tests.py(+0 -27)📝
tests/test_auth.py(+106 -76)📝
tests/test_auth2.py(+42 -21)➕
tests/test_client_credentials.py(+44 -0)📝
tests/test_oauth.py(+10 -2)📝
tests/tests.py(+51 -18)📝
tox.ini(+2 -1)📄 Description
Changes in this PR involve
adding the UTF-8 source code encoding declaration to all Python modules (https://www.python.org/dev/peps/pep-0008/#source-file-encoding)
re-ordering imports so that they conform to the PEP8 recommendations (https://www.python.org/dev/peps/pep-0008/#imports)
adding the absolute path of the
spotifypackage tosys.pathin all test modulesremoving all test data initialisation in a test module to a class method (
setUpClass) in the relevant test classmodifying client authentication code in
tests/tests.pyandtests/authtests.pyto expect and use environment variables for client credentials -SPOTIPY_CLIENT_USERNAME,SPOTIPY_CLIENT_ID,SPOTIPY_CLIENT_SECRET,SPOTIPY_REDIRECT_URIcleaning up invalid variable references in test modules, e.g. replacing module-level variable references to Spotify client objects by test class instance variables, i.e replace
spotifybyself.spotifywhereselfis the relevant test class instancefixing user-related test case errors in
tests/authtests.py- Spotify lowercases user names so that the user name comparison in the test casestest_basic_user_profile,test_current_user,test_mewould always fail for mixed case or upper-cased test user namesfixing a logic error in test case
tests/authtests.AuthTestSpotify.test_user_playlist_follow- the playlist follower checking and assertion should be of the currently authenticated user notplamere, who is the test playlist owneradding test dependencies
mock==2.0.0andsimplejson==3.13.2torequirements.txtandsetup.py, and updatingtox.inito add thesimplejsondependencyrenaming some of the test modules to make them discoverable using
unittestdiscovery -authtests.py->test_auth.py,authtests2.py->test_auth2.py,client_credentials_tests.py->test_client_credentials.pyandupdating
.gitignoreto ignore Shell scriptsThe status of the tests is that all test suites pass 100% except for
tests/authtests.py- failures/errors intests/authtests.pyare related to the fact that the test application user, for whom credentials were created, does not appear to be the same as the currently authenticated user. This affects the test casestest_user_playlist_ops,test_current_user,test_me:🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.