diff --git a/.gitignore b/.gitignore --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ dist/ *.egg-info version.txt +.tox/ diff --git a/requirements-test.txt b/requirements-test.txt --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1 +1,3 @@ -nose +pytest +dulwich >= 0.18.7 +swh.loader.git diff --git a/swh/vault/cookers/base.py b/swh/vault/cookers/base.py --- a/swh/vault/cookers/base.py +++ b/swh/vault/cookers/base.py @@ -90,7 +90,7 @@ Override this in the cooker implementation. """ - raise NotImplemented + raise NotImplementedError @abc.abstractmethod def prepare_bundle(self): @@ -98,7 +98,7 @@ Override this with the cooker implementation. """ - raise NotImplemented + raise NotImplementedError def write(self, chunk): self.fileobj.write(chunk) @@ -118,7 +118,7 @@ except PolicyError as e: self.backend.set_status(self.obj_type, self.obj_id, 'failed') self.backend.set_progress(self.obj_type, self.obj_id, str(e)) - except Exception as e: + except Exception: self.backend.set_status(self.obj_type, self.obj_id, 'failed') self.backend.set_progress( self.obj_type, self.obj_id, diff --git a/swh/vault/tests/test_cookers.py b/swh/vault/tests/test_cookers.py --- a/swh/vault/tests/test_cookers.py +++ b/swh/vault/tests/test_cookers.py @@ -1,4 +1,4 @@ -# Copyright (C) 2017 The Software Heritage developers +# Copyright (C) 2017-2018 The Software Heritage developers # See the AUTHORS file at the top-level directory of this distribution # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information @@ -9,6 +9,7 @@ import io import os import pathlib +import pytest import subprocess import tarfile import tempfile @@ -100,6 +101,7 @@ self.git_shell(*args, stdout=None) +@pytest.mark.config_issue class BaseTestCookers(VaultTestFixture): """Base class of cookers unit tests""" def setUp(self): diff --git a/tox.ini b/tox.ini new file mode 100644 --- /dev/null +++ b/tox.ini @@ -0,0 +1,17 @@ +[tox] +envlist=flake8,py3 + +[testenv:py3] +deps = + .[testing] + pytest-cov + pifpaf +commands = + pifpaf run postgresql -- pytest --cov=swh --cov-branch {posargs} -m 'not config_issue' + +[testenv:flake8] +skip_install = true +deps = + flake8 +commands = + {envpython} -m flake8