From 2603ec5caec9176921f8746360d10ba9c874e452 Mon Sep 17 00:00:00 2001 From: Jacopo Notarstefano Date: Fri, 2 Feb 2018 19:26:23 +0100 Subject: [PATCH] global: don't use pytest-flake8 Remove ``pytest-flake8`` and replace it with just ``flake8`` as the former is sometimes not finding style violations present in the code. Signed-off-by: Jacopo Notarstefano --- .travis.yml | 2 +- run-tests.sh | 26 ++++++++++++++++++++++++++ setup.cfg | 6 ++++-- setup.py | 1 - tests/test_cds.py | 26 +++++++++++++------------- tests/test_hep_bd9xx.py | 2 +- 6 files changed, 45 insertions(+), 18 deletions(-) create mode 100755 run-tests.sh diff --git a/.travis.yml b/.travis.yml index e5a0938f..2b6a829d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,7 +45,7 @@ install: - travis_retry pip install -e .[tests] script: - - py.test inspire_dojson tests + - ./run-tests.sh after_success: - coveralls diff --git a/run-tests.sh b/run-tests.sh new file mode 100755 index 00000000..ac5a34cd --- /dev/null +++ b/run-tests.sh @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +# +# This file is part of INSPIRE. +# Copyright (C) 2014-2017 CERN. +# +# INSPIRE is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# INSPIRE is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with INSPIRE. If not, see . +# +# In applying this license, CERN does not waive the privileges and immunities +# granted to it by virtue of its status as an Intergovernmental Organization +# or submit itself to any jurisdiction. + +set -e + +flake8 inspire_dojson tests +py.test tests diff --git a/setup.cfg b/setup.cfg index 3fc720ff..42b3ee73 100644 --- a/setup.cfg +++ b/setup.cfg @@ -28,5 +28,7 @@ include = inspire_dojson/*.py [tool:pytest] -addopts = --cov=inspire_dojson --cov-report=term-missing:skip-covered --flake8 -flake8-ignore = *.py E501 FI12 FI14 FI15 FI16 FI17 FI50 FI51 FI53 +addopts = --cov=inspire_dojson --cov-report=term-missing:skip-covered + +[flake8] +ignore = *.py E501 FI12 FI14 FI15 FI16 FI17 FI50 FI51 FI53 diff --git a/setup.py b/setup.py index 21c57b11..77971fad 100644 --- a/setup.py +++ b/setup.py @@ -53,7 +53,6 @@ 'mock~=2.0,>=2.0.0', 'pytest~=3.0,>=3.1.2', 'pytest-cov~=2.0,>=2.5.1', - 'pytest-flake8~=0.0,>=0.8.1', ] extras_require = { diff --git a/tests/test_cds.py b/tests/test_cds.py index de5386c0..081221cd 100644 --- a/tests/test_cds.py +++ b/tests/test_cds.py @@ -1194,13 +1194,13 @@ def test_documents_from_8564_s_u_y_8(): ) # cds.cern.ch/record/2294664 expected = [ - { - 't': 'CDS', - 'a': 'http://cds.cern.ch/record/2294664/files/James.pdf', - 'd': 'Fulltext', - 'n': 'James.pdf', - 'f': '.pdf', - }, + { + 't': 'CDS', + 'a': 'http://cds.cern.ch/record/2294664/files/James.pdf', + 'd': 'Fulltext', + 'n': 'James.pdf', + 'f': '.pdf', + }, ] result = cds2hep_marc.do(create_record(snippet)) @@ -1208,12 +1208,12 @@ def test_documents_from_8564_s_u_y_8(): expected = [ { - 'key': 'James.pdf', - 'fulltext': True, - 'source': 'CDS', - 'url': 'http://cds.cern.ch/record/2294664/files/James.pdf', - }, - ] + 'key': 'James.pdf', + 'fulltext': True, + 'source': 'CDS', + 'url': 'http://cds.cern.ch/record/2294664/files/James.pdf', + }, + ] result = hep.do(create_record_from_dict(result)) assert validate(result['documents'], subschema) is None diff --git a/tests/test_hep_bd9xx.py b/tests/test_hep_bd9xx.py index 31531cd0..4a3425fe 100644 --- a/tests/test_hep_bd9xx.py +++ b/tests/test_hep_bd9xx.py @@ -1340,7 +1340,7 @@ def test_references_from_999C5k(): { 'k': 'Robilotta:2008js', 'z': 0, - }, + }, ] result = hep2marc.do(result)