From 955dd69ab0baa399ad30455c2475104f886d5837 Mon Sep 17 00:00:00 2001 From: Alexey Stepanov Date: Mon, 29 Aug 2016 08:26:11 +0300 Subject: [PATCH] Make coverage report human-readable on gates Make coverage report human-readable on gates Require minimal coverage of moved helpers: 75% Change-Id: I59c589e8626bfa23fbf4f06845db27775f9714a2 (cherry picked from commit e96978d) --- core/_tests/helpers/test_http.py | 4 +++- core/_tests/helpers/test_setup_teardown.py | 13 +++++++------ core/_tests/models/test_collector_client.py | 4 +++- tox.ini | 5 +++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/core/_tests/helpers/test_http.py b/core/_tests/helpers/test_http.py index f9c018d36..e899dcb76 100644 --- a/core/_tests/helpers/test_http.py +++ b/core/_tests/helpers/test_http.py @@ -2,8 +2,10 @@ from __future__ import absolute_import import unittest -from mock import patch +# pylint: disable=import-error from mock import call +from mock import patch +# pylint: enable=import-error from core.helpers.http import HTTPClientZabbix diff --git a/core/_tests/helpers/test_setup_teardown.py b/core/_tests/helpers/test_setup_teardown.py index cb5d03801..2f1fe744b 100644 --- a/core/_tests/helpers/test_setup_teardown.py +++ b/core/_tests/helpers/test_setup_teardown.py @@ -3,8 +3,10 @@ from __future__ import print_function import unittest +# pylint: disable=import-error from mock import call from mock import patch +# pylint: enable=import-error from core.helpers import setup_teardown @@ -159,6 +161,11 @@ class TestWrappers(unittest.TestCase): 'cls was not filtered from @classmethod!' ) + # Allow to replace function by None in special cases + self.assertIsNone( + call_in_context(None, {'test_arg': 'test_val'}) + ) + @patch('core.helpers.setup_teardown.__getcallargs', return_value={'arg': True}) @patch('core.helpers.setup_teardown.__call_in_context') @@ -166,12 +173,6 @@ class TestSetupTeardown(unittest.TestCase): def test_basic(self, call_in, getargs): arg = True - def setup_func(): - pass - - def teardown_func(): - pass - @setup_teardown.setup_teardown() def positive_example(arg): return arg diff --git a/core/_tests/models/test_collector_client.py b/core/_tests/models/test_collector_client.py index 14f0c45f9..1d1f20c63 100644 --- a/core/_tests/models/test_collector_client.py +++ b/core/_tests/models/test_collector_client.py @@ -3,8 +3,10 @@ from __future__ import unicode_literals import unittest -from mock import patch +# pylint: disable=import-error from mock import call +from mock import patch +# pylint: enable=import-error from core.models.collector_client import CollectorClient diff --git a/tox.ini b/tox.ini index 57706d8c7..e49c0e907 100644 --- a/tox.ini +++ b/tox.ini @@ -49,7 +49,7 @@ deps= {[testenv]deps} pylint commands= - pylint --rcfile=.pylintrc_gerrit fuelweb_test system_test gates_tests run_system_test + pylint --rcfile=.pylintrc_gerrit fuelweb_test system_test gates_tests run_system_test core [testenv:pylint-py27-fuelweb] @@ -85,4 +85,5 @@ deps = {[testenv]deps} commands = py.test --cov-config .coveragerc --cov-report html --cov=core core/_tests - coverage report + coverage html -d {envlogdir} + coverage report --fail-under 75