Add pre-commit and fix isort

This commit is contained in:
Hugo 2019-09-26 10:31:49 +03:00
parent 695a11a4cd
commit d589c5ef8a
6 changed files with 42 additions and 16 deletions

36
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,36 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v1.24.0
hooks:
- id: pyupgrade
- repo: https://github.com/psf/black
rev: 19.3b0
hooks:
- id: black
language_version: python3.7
# override until resolved: https://github.com/psf/black/issues/402
files: \.pyi?$
types: []
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.8
hooks:
- id: flake8
additional_dependencies: [flake8-2020]
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
language_version: python3.7
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.4.1
hooks:
- id: python-check-blanket-noqa
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: check-yaml

View file

@ -18,7 +18,6 @@ matrix:
env: TOXENV=lint
- python: 3.7
env: TOXENV=py37
dist: xenial
- python: 3.6
env: TOXENV=py36
- python: 3.5
@ -27,7 +26,6 @@ matrix:
env: TOXENV=pypy3
- python: 3.8-dev
env: TOXENV=py38dev
dist: xenial
allow_failures:
- env: TOXENV=pypy3
fast_finish: true

View file

@ -4,9 +4,8 @@ Integration (not unit) tests for pylast.py
"""
import unittest
from flaky import flaky
import pylast
from flaky import flaky
from .test_pylast import PyLastTestCase, load_secrets

View file

@ -7,12 +7,10 @@ import sys
import time
import unittest
import pylast
import pytest
from flaky import flaky
import pylast
PY37 = sys.version_info[:2] == (3, 7)

View file

@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-
import mock
import pytest
import pylast
import pytest
def mock_network():

10
tox.ini
View file

@ -23,10 +23,6 @@ deps = ipdb
commands = {posargs}
[testenv:lint]
deps =
flake8
pep8-naming
black
commands =
flake8 .
black --check --diff .
deps = pre-commit
commands = pre-commit run --all-files
skip_install = true