From 387220c1d67a88dde6d66e3581e6bd428cd10ed6 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Mon, 5 Jan 2015 15:52:02 -0800 Subject: [PATCH 01/11] Make pylast a package. Move tests into a directory. Start using pytest and tox. Use setuptools instead of distutils. --- .build | 1 + .travis.yml | 4 ++-- check.sh | 8 ++++---- pylast.py => pylast/__init__.py | 0 setup.py | 8 +++++--- tests/__init__.py | 0 test_pylast.py => tests/test_pylast.py | 0 tox.ini | 11 +++++++++++ 8 files changed, 23 insertions(+), 9 deletions(-) create mode 100644 .build rename pylast.py => pylast/__init__.py (100%) create mode 100644 tests/__init__.py rename test_pylast.py => tests/test_pylast.py (100%) create mode 100644 tox.ini diff --git a/.build b/.build new file mode 100644 index 0000000..c227083 --- /dev/null +++ b/.build @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 9271b54..9efd262 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ install: - travis_retry pip install -r test_requirements.txt - travis_retry pip install coveralls -script: coverage run --source=pylast ./test_pylast.py +script: coverage run --source=pylast ./tests/test_pylast.py after_success: - coveralls @@ -24,7 +24,7 @@ after_script: - coverage report - ./check.sh - pip install clonedigger -- clonedigger pylast.py +- clonedigger pylast - grep "Clones detected" output.html - grep "lines are duplicates" output.html diff --git a/check.sh b/check.sh index 0e2c1d2..2aca7ef 100755 --- a/check.sh +++ b/check.sh @@ -1,10 +1,10 @@ -pyflakes pylast.py +pyflakes pylast echo --- -pyflakes test_pylast.py +pyflakes tests echo --- -pep8 test_pylast.py +pep8 pylast echo --- -pep8 pylast.py +pep8 tests # echo --- # clonedigger pylast.py # grep "Clones detected" output.html diff --git a/pylast.py b/pylast/__init__.py similarity index 100% rename from pylast.py rename to pylast/__init__.py diff --git a/setup.py b/setup.py index baadad3..8e73099 100755 --- a/setup.py +++ b/setup.py @@ -1,12 +1,14 @@ #!/usr/bin/env python +import os -from distutils.core import setup +from setuptools import setup, find_packages setup( name="pylast", version="1.0.0", author="Amr Hassan ", + tests_require=['mock', 'pytest', 'coverage', 'pep8', 'pyyaml', 'pyflakes'], description=("A Python interface to Last.fm " "(and other API compatible social networks)"), author_email="amr.hassan@gmail.com", @@ -24,8 +26,8 @@ setup( "Programming Language :: Python :: 3.4", ], keywords=["Last.fm", "music", "scrobble", "scrobbling"], - py_modules=("pylast",), + packages=find_packages(exclude=('tests*')), license="Apache2" - ) +) # End of file diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/test_pylast.py b/tests/test_pylast.py similarity index 100% rename from test_pylast.py rename to tests/test_pylast.py diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..8565df0 --- /dev/null +++ b/tox.ini @@ -0,0 +1,11 @@ +[tox] +envlist = py34, py27 +recreate = False + +[testenv] +downloadcache = {homedir}/.pipcache +changedir = tests +deps = + pytest + mock +commands = py.test {posargs} \ No newline at end of file From c2b03afe559c4af1c77d40c02bfc7d7d01e039c9 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Mon, 5 Jan 2015 15:55:45 -0800 Subject: [PATCH 02/11] Don't encode strings as 'utf-8' twice in _get_cache_key. Closes #109. --- pylast/__init__.py | 2 +- tests/request_test.py | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 tests/request_test.py diff --git a/pylast/__init__.py b/pylast/__init__.py index 8005c71..7020eee 100644 --- a/pylast/__init__.py +++ b/pylast/__init__.py @@ -1070,7 +1070,7 @@ class _Request(object): for key in keys: if key != "api_sig" and key != "api_key" and key != "sk": - cache_key += key + _string(self.params[key]) + cache_key += key + self.params[key] return hashlib.sha1(cache_key.encode("utf-8")).hexdigest() diff --git a/tests/request_test.py b/tests/request_test.py new file mode 100644 index 0000000..fb18091 --- /dev/null +++ b/tests/request_test.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +import mock +import pytest + +import pylast + + +def mock_network(): + return mock.Mock( + _get_ws_auth=mock.Mock(return_value=("", "", "")) + ) + +@pytest.mark.parametrize('unicode_artist', [u'\xe9lafdasfdsafdsa', u'éééééééé']) +def test_get_cache_key(unicode_artist): + request = pylast._Request(mock_network(), 'some_method', + params={'artist': unicode_artist}) + request._get_cache_key() From ca66e74099104183956b61944fc76a2746ebf40f Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 7 Jan 2015 17:57:04 -0800 Subject: [PATCH 03/11] tox/travis stuff. making testing more uniform. --- .travis.yml | 30 ++++++++++--------------- check.sh | 11 ---------- test_requirements.txt | 4 ---- tests/request_test.py | 3 ++- tests/test_pylast.py | 51 ------------------------------------------- tox.ini | 25 ++++++++++++++++++--- 6 files changed, 35 insertions(+), 89 deletions(-) delete mode 100755 check.sh delete mode 100644 test_requirements.txt diff --git a/.travis.yml b/.travis.yml index 9efd262..f96caf8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,32 +1,24 @@ language: python -python: -- "2.7" -- "3.3" -- "3.4" -- "pypy" -- "pypy3" +env: +- TOXENV=py27 +- TOXENV=py33 +- TOXENV=py34 +- TOXENV=pypy +- TOXENV=pypy3 +- TOXENV=lint sudo: false install: -- travis_retry pip install -r test_requirements.txt - travis_retry pip install coveralls -script: coverage run --source=pylast ./tests/test_pylast.py +script: tox after_success: -- coveralls -- travis_retry pip install scrutinizer-ocular -- ocular - -after_script: -- coverage report -- ./check.sh -- pip install clonedigger -- clonedigger pylast -- grep "Clones detected" output.html -- grep "lines are duplicates" output.html +- "if [ $TOXENV == 'py27' ]; then pip install coveralls; coveralls; fi" +- "if [ $TOXENV == 'py27' ]; then travis_retry pip install scrutinizer-ocular; ocular; fi" +- "if [ $TOXENV == 'py27' ]; then travis_retry pip install scrutinizer-ocular; ocular; fi" env: global: diff --git a/check.sh b/check.sh deleted file mode 100755 index 2aca7ef..0000000 --- a/check.sh +++ /dev/null @@ -1,11 +0,0 @@ -pyflakes pylast -echo --- -pyflakes tests -echo --- -pep8 pylast -echo --- -pep8 tests -# echo --- -# clonedigger pylast.py -# grep "Clones detected" output.html -# grep "lines are duplicates" output.html diff --git a/test_requirements.txt b/test_requirements.txt deleted file mode 100644 index d304a29..0000000 --- a/test_requirements.txt +++ /dev/null @@ -1,4 +0,0 @@ -coverage -pep8 -pyyaml -pyflakes diff --git a/tests/request_test.py b/tests/request_test.py index fb18091..bb72f62 100644 --- a/tests/request_test.py +++ b/tests/request_test.py @@ -10,7 +10,8 @@ def mock_network(): _get_ws_auth=mock.Mock(return_value=("", "", "")) ) -@pytest.mark.parametrize('unicode_artist', [u'\xe9lafdasfdsafdsa', u'éééééééé']) + +@pytest.mark.parametrize('unicode_artist', [u'\xe9lafdasfdsafdsa', u'ééééééé]) def test_get_cache_key(unicode_artist): request = pylast._Request(mock_network(), 'some_method', params={'artist': unicode_artist}) diff --git a/tests/test_pylast.py b/tests/test_pylast.py index bc5dcb8..8f2fe90 100755 --- a/tests/test_pylast.py +++ b/tests/test_pylast.py @@ -2,7 +2,6 @@ """ Integration (not unit) tests for pylast.py """ -import argparse import os from random import choice import sys @@ -1909,54 +1908,4 @@ class TestPyLast(unittest.TestCase): self.assertEqual(str(tracks[0].track.artist), "Johnny Cash") self.assertEqual(str(tracks[0].track.title), "Ring of Fire") - -if __name__ == '__main__': - parser = argparse.ArgumentParser( - description="Integration (not unit) tests for pylast.py", - formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument( - '-1', '--single', - help="Run a single test") - parser.add_argument( - '-r', '--repeat', - help="Repeat a single test (100 times) until failure") - parser.add_argument( - '-m', '--matching', - help="Run tests with this in the name") - args = parser.parse_args() - - if args.single: - suite = unittest.TestSuite() - - suite.addTest(TestPyLast(args.single)) - unittest.TextTestRunner().run(suite) - - elif args.repeat: - suite = unittest.TestSuite() - - suite.addTest(TestPyLast(args.repeat)) - for i in range(100): - print("Attempt " + str(i+1)) - result = unittest.TextTestRunner().run(suite) - problems = len(result.errors) + len(result.failures) - if problems: - break - - elif args.matching: - suite = unittest.TestSuite() - - import inspect - methods = inspect.getmembers(TestPyLast, predicate=inspect.ismethod) - - tests = [] - for method, _ in methods: - if method.startswith("test_") and args.matching in method: - print(method) - suite.addTest(TestPyLast(method)) - - unittest.TextTestRunner().run(suite) - - else: - unittest.main(failfast=True) - # End of file diff --git a/tox.ini b/tox.ini index 8565df0..03fee87 100644 --- a/tox.ini +++ b/tox.ini @@ -1,11 +1,30 @@ [tox] -envlist = py34, py27 +envlist = py34, py27, pypy, pypy3 recreate = False [testenv] downloadcache = {homedir}/.pipcache -changedir = tests deps = + pyyaml pytest mock -commands = py.test {posargs} \ No newline at end of file + pytest-cov +commands = py.test --doctest-modules -v --cov pylast --cov-report term-missing + +[testenv:venv] +deps = ipdb +commands = {posargs} + +[testenv:lint] +deps = + coverage + pep8 + pyyaml + pyflakes + clonedigger +commands = + pyflakes pylast + pyflakes tests + pep8 pylast + pep8 tests + clonedigger pylast -o /dev/stdout | grep -E "Clones detected\|lines are duplicates" \ No newline at end of file From a64d562ae2bb5f0e7781866b3ab407b821d8805f Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 7 Jan 2015 18:00:36 -0800 Subject: [PATCH 04/11] Add tox to travis installation. --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index f96caf8..63c9582 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,7 @@ env: sudo: false install: +- travis_retry pip install tox - travis_retry pip install coveralls script: tox From b66ee21ce01be0d4d1db07eead1b82ca3f123f93 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 7 Jan 2015 18:04:46 -0800 Subject: [PATCH 05/11] Consolidate travis environments. separate matrix and global environment variables. --- .travis.yml | 25 ++++++++++++------------- tests/request_test.py | 2 +- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 63c9582..fc5e997 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,18 @@ language: python env: -- TOXENV=py27 -- TOXENV=py33 -- TOXENV=py34 -- TOXENV=pypy -- TOXENV=pypy3 -- TOXENV=lint + global: + - secure: ivg6II471E9HV8xyqnawLIuP/sZ0J63Y+BC0BQcRVKtLn/K3zmD1ozM3TFL9S549Nxd0FqDKHXJvXsgaTGIDpK8sxE2AMKV5IojyM0iAVuN7YjPK9vwSlRw1u0EysPMFqxOZVQnoDyHrSGIUrP/VMdnhBu6dbUX0FyEkvZshXhY= + - secure: gDWNEYA1EUv4G230/KzcTgcmEST0nf2FeW/z/prsoQBu+TWw1rKKSJAJeMLvuI1z4aYqqNYdmqjWyNhhVK3p5wmFP2lxbhaBT1jDsxxFpePc0nUkdAQOOD0yBpbBGkqkjjxU34HjTX2NFNEbcM3izVVE9oQmS5r4oFFNJgdL91c= + - secure: RpsZblHFU7a5dnkO/JUgi70RkNJwoUh3jJqVo1oOLjL+lvuAmPXhI8MDk2diUk43X+XCBFBEnm7UCGnjUF+hDnobO4T+VrIFuVJWg3C7iKIT+YWvgG6A+CSeo/P0I0dAeUscTr5z4ylOq3EDx4MFSa8DmoWMmjKTAG1GAeTlY2k= + - secure: T5OKyd5Bs0nZbUr+YICbThC5GrFq/kUjX8FokzCv7NWsYaUWIwEmMXXzoYALoB3A+rAglOx6GABaupoNKKg3tFQyxXphuMKpZ8MasMAMFjFW0d7wsgGy0ylhVwrgoKzDbCQ5FKbohC+9ltLs+kKMCQ0L+MI70a/zTfF4/dVWO/o= + matrix: + - TOXENV=py27 + - TOXENV=py33 + - TOXENV=py34 + - TOXENV=pypy + - TOXENV=pypy3 + - TOXENV=lint sudo: false @@ -21,13 +27,6 @@ after_success: - "if [ $TOXENV == 'py27' ]; then travis_retry pip install scrutinizer-ocular; ocular; fi" - "if [ $TOXENV == 'py27' ]; then travis_retry pip install scrutinizer-ocular; ocular; fi" -env: - global: - - secure: ivg6II471E9HV8xyqnawLIuP/sZ0J63Y+BC0BQcRVKtLn/K3zmD1ozM3TFL9S549Nxd0FqDKHXJvXsgaTGIDpK8sxE2AMKV5IojyM0iAVuN7YjPK9vwSlRw1u0EysPMFqxOZVQnoDyHrSGIUrP/VMdnhBu6dbUX0FyEkvZshXhY= - - secure: gDWNEYA1EUv4G230/KzcTgcmEST0nf2FeW/z/prsoQBu+TWw1rKKSJAJeMLvuI1z4aYqqNYdmqjWyNhhVK3p5wmFP2lxbhaBT1jDsxxFpePc0nUkdAQOOD0yBpbBGkqkjjxU34HjTX2NFNEbcM3izVVE9oQmS5r4oFFNJgdL91c= - - secure: RpsZblHFU7a5dnkO/JUgi70RkNJwoUh3jJqVo1oOLjL+lvuAmPXhI8MDk2diUk43X+XCBFBEnm7UCGnjUF+hDnobO4T+VrIFuVJWg3C7iKIT+YWvgG6A+CSeo/P0I0dAeUscTr5z4ylOq3EDx4MFSa8DmoWMmjKTAG1GAeTlY2k= - - secure: T5OKyd5Bs0nZbUr+YICbThC5GrFq/kUjX8FokzCv7NWsYaUWIwEmMXXzoYALoB3A+rAglOx6GABaupoNKKg3tFQyxXphuMKpZ8MasMAMFjFW0d7wsgGy0ylhVwrgoKzDbCQ5FKbohC+9ltLs+kKMCQ0L+MI70a/zTfF4/dVWO/o= - matrix: allow_failures: - python: "3.4" diff --git a/tests/request_test.py b/tests/request_test.py index bb72f62..24fdf66 100644 --- a/tests/request_test.py +++ b/tests/request_test.py @@ -11,7 +11,7 @@ def mock_network(): ) -@pytest.mark.parametrize('unicode_artist', [u'\xe9lafdasfdsafdsa', u'ééééééé]) +@pytest.mark.parametrize('unicode_artist', [u'\xe9lafdasfdsafdsa', u'ééééééé']) def test_get_cache_key(unicode_artist): request = pylast._Request(mock_network(), 'some_method', params={'artist': unicode_artist}) From 6e6ff1a41703f0db49759353684f8fe428babcd9 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 7 Jan 2015 18:20:30 -0800 Subject: [PATCH 06/11] Get rid of --doctest-modules in py.test command. --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 03fee87..5d6cdb9 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,7 @@ deps = pytest mock pytest-cov -commands = py.test --doctest-modules -v --cov pylast --cov-report term-missing +commands = py.test -v --cov pylast --cov-report term-missing [testenv:venv] deps = ipdb From f2f8ca086d21aefdabe7571cd8c9b6a4c7c2aa94 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 7 Jan 2015 19:25:41 -0800 Subject: [PATCH 07/11] add posargs to tox tests. --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 5d6cdb9..21c569b 100644 --- a/tox.ini +++ b/tox.ini @@ -9,7 +9,7 @@ deps = pytest mock pytest-cov -commands = py.test -v --cov pylast --cov-report term-missing +commands = py.test -v --cov pylast --cov-report term-missing {posargs} [testenv:venv] deps = ipdb From 6d84446f0385cce2b0195f57920d07118bf8b724 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 7 Jan 2015 19:27:28 -0800 Subject: [PATCH 08/11] Add failing test for #114 --- tests/request_test.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/request_test.py b/tests/request_test.py index 24fdf66..1c8a4c2 100644 --- a/tests/request_test.py +++ b/tests/request_test.py @@ -11,8 +11,11 @@ def mock_network(): ) -@pytest.mark.parametrize('unicode_artist', [u'\xe9lafdasfdsafdsa', u'ééééééé']) -def test_get_cache_key(unicode_artist): +@pytest.mark.parametrize('troublesome_artist', [ + u'\xe9lafdasfdsafdsa', u'ééééééé', + pylast.Artist(u'B\xe9l', mock_network()) +]) +def test_get_cache_key(troublesome_artist): request = pylast._Request(mock_network(), 'some_method', - params={'artist': unicode_artist}) + params={'artist': troublesome_artist}) request._get_cache_key() From f1e14f591c083b8bb1834aa9f8c5ce66e4d5a458 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 7 Jan 2015 19:39:09 -0800 Subject: [PATCH 09/11] add credentials for IvanMalison/pylast. --- .travis.yml | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/.travis.yml b/.travis.yml index fc5e997..e5dd406 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,35 +1,35 @@ language: python - env: global: - - secure: ivg6II471E9HV8xyqnawLIuP/sZ0J63Y+BC0BQcRVKtLn/K3zmD1ozM3TFL9S549Nxd0FqDKHXJvXsgaTGIDpK8sxE2AMKV5IojyM0iAVuN7YjPK9vwSlRw1u0EysPMFqxOZVQnoDyHrSGIUrP/VMdnhBu6dbUX0FyEkvZshXhY= - - secure: gDWNEYA1EUv4G230/KzcTgcmEST0nf2FeW/z/prsoQBu+TWw1rKKSJAJeMLvuI1z4aYqqNYdmqjWyNhhVK3p5wmFP2lxbhaBT1jDsxxFpePc0nUkdAQOOD0yBpbBGkqkjjxU34HjTX2NFNEbcM3izVVE9oQmS5r4oFFNJgdL91c= - - secure: RpsZblHFU7a5dnkO/JUgi70RkNJwoUh3jJqVo1oOLjL+lvuAmPXhI8MDk2diUk43X+XCBFBEnm7UCGnjUF+hDnobO4T+VrIFuVJWg3C7iKIT+YWvgG6A+CSeo/P0I0dAeUscTr5z4ylOq3EDx4MFSa8DmoWMmjKTAG1GAeTlY2k= - - secure: T5OKyd5Bs0nZbUr+YICbThC5GrFq/kUjX8FokzCv7NWsYaUWIwEmMXXzoYALoB3A+rAglOx6GABaupoNKKg3tFQyxXphuMKpZ8MasMAMFjFW0d7wsgGy0ylhVwrgoKzDbCQ5FKbohC+9ltLs+kKMCQ0L+MI70a/zTfF4/dVWO/o= + - secure: ivg6II471E9HV8xyqnawLIuP/sZ0J63Y+BC0BQcRVKtLn/K3zmD1ozM3TFL9S549Nxd0FqDKHXJvXsgaTGIDpK8sxE2AMKV5IojyM0iAVuN7YjPK9vwSlRw1u0EysPMFqxOZVQnoDyHrSGIUrP/VMdnhBu6dbUX0FyEkvZshXhY= + - secure: gDWNEYA1EUv4G230/KzcTgcmEST0nf2FeW/z/prsoQBu+TWw1rKKSJAJeMLvuI1z4aYqqNYdmqjWyNhhVK3p5wmFP2lxbhaBT1jDsxxFpePc0nUkdAQOOD0yBpbBGkqkjjxU34HjTX2NFNEbcM3izVVE9oQmS5r4oFFNJgdL91c= + - secure: RpsZblHFU7a5dnkO/JUgi70RkNJwoUh3jJqVo1oOLjL+lvuAmPXhI8MDk2diUk43X+XCBFBEnm7UCGnjUF+hDnobO4T+VrIFuVJWg3C7iKIT+YWvgG6A+CSeo/P0I0dAeUscTr5z4ylOq3EDx4MFSa8DmoWMmjKTAG1GAeTlY2k= + - secure: T5OKyd5Bs0nZbUr+YICbThC5GrFq/kUjX8FokzCv7NWsYaUWIwEmMXXzoYALoB3A+rAglOx6GABaupoNKKg3tFQyxXphuMKpZ8MasMAMFjFW0d7wsgGy0ylhVwrgoKzDbCQ5FKbohC+9ltLs+kKMCQ0L+MI70a/zTfF4/dVWO/o= + - secure: DxBvGGoIgbAeuuU3A6+J1HBbmUAEvqdmK73etw+yNKDLGvvukgTL33dNCr8CZXLKRRvfhrjU7Q01GUpOTxrVQ9nJgsD55kwx0wPtuBWIF80M2m4SPsiVLlwP/LFYD5JMDTDWjFTlVahma8P7qoLjCc7b/RgigWLidH19snQmjdY= + - secure: VPARlWNg/0Nit7a924vJlDfv7yiuTDtrcGZNFrZ6yN3dl8ZjVPizQXQNKA3yq0y2jW25nwjRwZYj3eY5MdM9F7Sw51d+/8AjFtdCuRgDvwlQFR/pCoyzqgJATkXKo7mlejvnA+5EKUzAmu3drIbboFgbLgRTMrG7b/ot9tazTHs= + - secure: CQYL7MH6tSVrCcluIfWfDSTo4E/p+9pF0eI7Vtf0oaZBzyulODHK8h/mzJp4HwezyfOu0RCedq6sloGQr1/29CvWWESaYyoGoGz9Mz2ZS+MpIcjGISfZa+x4vSp6QPFvd4i/1Z/1j2gJVVyswkrIVUwZIDJtfAKzZI5iHx2gH8Y= + - secure: SsKJoJwtDVWrL5xxl9C/gTRy6FhfRQQNNAFOogl9mTs/WeI2t9QTYoKsxLPXOdoRdu4MvT3h/B2sjwggt7zP81fBVxQRTkg4nq0zSHlj0NqclbFa6I5lUYdGwH9gPk/HWJJwXhKRDsqn/iRw2v+qBDs/j3kIgPQ0yjM58LEPXic= matrix: - - TOXENV=py27 - - TOXENV=py33 - - TOXENV=py34 - - TOXENV=pypy - - TOXENV=pypy3 - - TOXENV=lint - + - TOXENV=py27 + - TOXENV=py33 + - TOXENV=py34 + - TOXENV=pypy + - TOXENV=pypy3 + - TOXENV=lint sudo: false - install: - travis_retry pip install tox - travis_retry pip install coveralls - script: tox - after_success: -- "if [ $TOXENV == 'py27' ]; then pip install coveralls; coveralls; fi" -- "if [ $TOXENV == 'py27' ]; then travis_retry pip install scrutinizer-ocular; ocular; fi" -- "if [ $TOXENV == 'py27' ]; then travis_retry pip install scrutinizer-ocular; ocular; fi" - +- if [ $TOXENV == 'py27' ]; then pip install coveralls; coveralls; fi +- if [ $TOXENV == 'py27' ]; then travis_retry pip install scrutinizer-ocular; ocular; + fi +- if [ $TOXENV == 'py27' ]; then travis_retry pip install scrutinizer-ocular; ocular; + fi matrix: allow_failures: - - python: "3.4" - - python: "pypy" - - python: "pypy3" + - python: '3.4' + - python: pypy + - python: pypy3 fast_finish: true From 781df0c94f79e4fc8f8c62c00fdc63c1c91ee03a Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 7 Jan 2015 23:31:07 -0800 Subject: [PATCH 10/11] Remove duplicate line, Make test_pylast.py runnable as main again. --- .travis.yml | 7 ++----- tests/test_pylast.py | 4 +++- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index e5dd406..5c0f5be 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,11 +22,8 @@ install: - travis_retry pip install coveralls script: tox after_success: -- if [ $TOXENV == 'py27' ]; then pip install coveralls; coveralls; fi -- if [ $TOXENV == 'py27' ]; then travis_retry pip install scrutinizer-ocular; ocular; - fi -- if [ $TOXENV == 'py27' ]; then travis_retry pip install scrutinizer-ocular; ocular; - fi +- travis_retry pip install coveralls && coveralls +- travis_retry pip install scrutinizer-ocular && ocular matrix: allow_failures: - python: '3.4' diff --git a/tests/test_pylast.py b/tests/test_pylast.py index 8f2fe90..36f5c60 100755 --- a/tests/test_pylast.py +++ b/tests/test_pylast.py @@ -1908,4 +1908,6 @@ class TestPyLast(unittest.TestCase): self.assertEqual(str(tracks[0].track.artist), "Johnny Cash") self.assertEqual(str(tracks[0].track.title), "Ring of Fire") -# End of file + +if __name__ == '__main__': + unittest.main(failfast=True) From dd7fe504d37bd9a40c35d99881489b11e70586c0 Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Wed, 7 Jan 2015 23:31:48 -0800 Subject: [PATCH 11/11] Revert "Add failing test for #114" (This revert should be reverted later as the test from this commit should be made to pass eventually) This reverts commit 6d84446f0385cce2b0195f57920d07118bf8b724. --- tests/request_test.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/request_test.py b/tests/request_test.py index 1c8a4c2..24fdf66 100644 --- a/tests/request_test.py +++ b/tests/request_test.py @@ -11,11 +11,8 @@ def mock_network(): ) -@pytest.mark.parametrize('troublesome_artist', [ - u'\xe9lafdasfdsafdsa', u'ééééééé', - pylast.Artist(u'B\xe9l', mock_network()) -]) -def test_get_cache_key(troublesome_artist): +@pytest.mark.parametrize('unicode_artist', [u'\xe9lafdasfdsafdsa', u'ééééééé']) +def test_get_cache_key(unicode_artist): request = pylast._Request(mock_network(), 'some_method', - params={'artist': troublesome_artist}) + params={'artist': unicode_artist}) request._get_cache_key()