diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 648afd7..a045aa6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,21 +1,21 @@ repos: - repo: https://github.com/asottile/pyupgrade - rev: v1.24.0 + rev: v1.25.2 hooks: - id: pyupgrade args: ["--py3-plus"] - repo: https://github.com/psf/black - rev: 19.3b0 + rev: 19.10b0 hooks: - id: black - language_version: python3.7 + args: ["--target-version", "py35"] # override until resolved: https://github.com/psf/black/issues/402 files: \.pyi?$ types: [] - repo: https://gitlab.com/pycqa/flake8 - rev: 3.7.8 + rev: 3.7.9 hooks: - id: flake8 additional_dependencies: [flake8-2020] @@ -24,14 +24,14 @@ repos: rev: v4.3.21 hooks: - id: isort - language_version: python3.7 - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.4.1 + rev: v1.4.2 hooks: - id: python-check-blanket-noqa - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.3.0 + rev: v2.4.0 hooks: + - id: check-merge-conflict - id: check-yaml diff --git a/.travis.yml b/.travis.yml index 1a5a9fb..86bec65 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,8 @@ language: python -cache: pip +cache: + pip: true + directories: + - $HOME/.cache/pre-commit env: global: @@ -15,32 +18,26 @@ env: matrix: fast_finish: true include: - - python: 3.7 + - python: 3.8 env: TOXENV=lint + - python: 3.8 - python: 3.7 - env: TOXENV=py37 - python: 3.6 - env: TOXENV=py36 - python: 3.5 - env: TOXENV=py35 - python: pypy3 - env: TOXENV=pypy3 - - python: 3.8-dev - env: TOXENV=py38dev - allow_failures: - - env: TOXENV=pypy3 install: -- travis_retry pip install --upgrade pip -- travis_retry pip install --upgrade tox -- travis_retry pip install --upgrade coverage +- travis_retry pip install -U pip +- travis_retry pip install -U tox-travis script: tox after_success: -- travis_retry pip install coveralls && coveralls -- travis_retry pip install codecov && codecov -- travis_retry pip install scrutinizer-ocular && ocular + - | + if [ "$TOXENV" != "lint" ]; then + travis_retry pip install -U coveralls && coveralls + travis_retry pip install -U codecov && codecov + fi deploy: - provider: pypi diff --git a/INSTALL b/INSTALL deleted file mode 100644 index f664153..0000000 --- a/INSTALL +++ /dev/null @@ -1,4 +0,0 @@ -Installation Instructions -========================= - -Execute "python setup.py install" as a super user. diff --git a/MANIFEST.in b/MANIFEST.in index 82c478f..7992ecc 100755 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,5 +2,4 @@ graft src include setup.py include README.md include COPYING -include INSTALL recursive-include tests *.py diff --git a/README.md b/README.md index cb8d2de..fb6282d 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ pyLast [![PyPI version](https://img.shields.io/pypi/v/pylast.svg)](https://pypi.org/project/pylast/) [![Supported Python versions](https://img.shields.io/pypi/pyversions/pylast.svg)](https://pypi.org/project/pylast/) +[![PyPI downloads](https://img.shields.io/pypi/dm/pylast.svg)](https://pypistats.org/packages/pylast) [![Build status](https://travis-ci.org/pylast/pylast.svg?branch=master)](https://travis-ci.org/pylast/pylast) [![Coverage (Codecov)](https://codecov.io/gh/pylast/pylast/branch/master/graph/badge.svg)](https://codecov.io/gh/pylast/pylast) [![Coverage (Coveralls)](https://coveralls.io/repos/github/pylast/pylast/badge.svg?branch=master)](https://coveralls.io/github/pylast/pylast?branch=master) @@ -101,7 +102,7 @@ export PYLAST_API_SECRET=TODO_ENTER_YOURS_HERE To run all unit and integration tests: ```sh -pip install pytest flaky mock +pip install pytest flaky pytest ``` diff --git a/setup.cfg b/setup.cfg index 3d9c412..a9810ce 100644 --- a/setup.cfg +++ b/setup.cfg @@ -4,6 +4,3 @@ universal = 1 [flake8] ignore = W503 max_line_length = 88 - -[pycodestyle] -max_line_length = 88 diff --git a/setup.py b/setup.py index 37d38d2..ec7d16e 100755 --- a/setup.py +++ b/setup.py @@ -20,15 +20,9 @@ setup( author="Amr Hassan and Contributors", author_email="amr.hassan@gmail.com", url="https://github.com/pylast/pylast", - tests_require=[ - "coverage", - "flaky", - "mock", - "pycodestyle", - "pyflakes", - "pytest", - "pyyaml", - ], + extras_require={ + "tests": ["flaky", "pytest", "pytest-cov", "pytest-random-order", "pyyaml"] + }, python_requires=">=3.5", classifiers=[ "Development Status :: 5 - Production/Stable", @@ -40,6 +34,7 @@ setup( "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3 :: Only", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", diff --git a/src/pylast/__init__.py b/src/pylast/__init__.py index 18fe9a6..3e6038d 100644 --- a/src/pylast/__init__.py +++ b/src/pylast/__init__.py @@ -36,9 +36,7 @@ from xml.dom import Node, minidom from . import version __author__ = "Amr Hassan, hugovk, Mice Pápai" -__copyright__ = ( - "Copyright (C) 2008-2010 Amr Hassan, 2013-2019 hugovk, " "2017 Mice Pápai" -) +__copyright__ = "Copyright (C) 2008-2010 Amr Hassan, 2013-2019 hugovk, 2017 Mice Pápai" __license__ = "apache2" __email__ = "amr.hassan@gmail.com" __version__ = version.__version__ @@ -903,7 +901,7 @@ class _Request: headers = { "Content-type": "application/x-www-form-urlencoded", "Accept-Charset": "utf-8", - "User-Agent": "pylast" + "/" + __version__, + "User-Agent": "pylast/" + __version__, } (host_name, host_subdir) = self.network.ws_server diff --git a/tests/test_artist.py b/tests/test_artist.py index 914fa6a..0e3843f 100755 --- a/tests/test_artist.py +++ b/tests/test_artist.py @@ -5,6 +5,7 @@ Integration (not unit) tests for pylast.py import unittest import pylast +import pytest from .test_pylast import TestPyLastWithLastFm @@ -281,6 +282,7 @@ class TestPyLastArtist(TestPyLastWithLastFm): # Assert self.assertEqual(corrected_artist_name, "Guns N' Roses") + @pytest.mark.xfail def test_get_userplaycount(self): # Arrange artist = pylast.Artist("John Lennon", self.network, username=self.username) diff --git a/tests/test_user.py b/tests/test_user.py index a8b724d..f283014 100755 --- a/tests/test_user.py +++ b/tests/test_user.py @@ -7,6 +7,7 @@ import unittest import warnings import pylast +import pytest from .test_pylast import TestPyLastWithLastFm @@ -182,6 +183,7 @@ class TestPyLastUser(TestPyLastWithLastFm): # Assert self.assertEqual(lastfm_user, loaded_user) + @pytest.mark.xfail def test_cacheable_user(self): # Arrange lastfm_user = self.network.get_authenticated_user() diff --git a/tests/unicode_test.py b/tests/unicode_test.py index 416014e..7efcfea 100644 --- a/tests/unicode_test.py +++ b/tests/unicode_test.py @@ -1,4 +1,5 @@ -import mock +from unittest import mock + import pylast import pytest diff --git a/tox.ini b/tox.ini index a2eeafb..9107481 100644 --- a/tox.ini +++ b/tox.ini @@ -1,21 +1,14 @@ [tox] -envlist = py37, py36, py35, pypy3, py38dev +envlist = py38, py37, py36, py35, pypy3 recreate = False [testenv] +extras = tests setenv = PYLAST_USERNAME={env:PYLAST_USERNAME:} PYLAST_PASSWORD_HASH={env:PYLAST_PASSWORD_HASH:} PYLAST_API_KEY={env:PYLAST_API_KEY:} PYLAST_API_SECRET={env:PYLAST_API_SECRET:} -deps = - pyyaml - pytest - mock - ipdb - pytest-cov - pytest-random-order - flaky commands = pytest -v -s -W all --cov pylast --cov-report term-missing --random-order {posargs} [testenv:venv]