Auto merge of #2389 - micbou:coverage-test-utils, r=Valloric

[READY] Move test_utils.py file to tests folder

We don't want `test_utils.py` to appear in the coverage reports. Instead of blacklisting it in `.coveragerc`, we move it to the tests folder.

This will decrease coverage.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/youcompleteme/2389)
<!-- Reviewable:end -->
This commit is contained in:
Homu 2016-10-15 21:19:46 +09:00
commit ddf18cc6ec
12 changed files with 25 additions and 23 deletions

View File

@ -23,7 +23,7 @@ from future import standard_library
standard_library.install_aliases() standard_library.install_aliases()
from builtins import * # noqa from builtins import * # noqa
from ycm.test_utils import ExtendedMock, MockVimModule from ycm.tests.test_utils import ExtendedMock, MockVimModule
MockVimModule() MockVimModule()
import json import json

View File

@ -1,4 +1,4 @@
# Copyright (C) 2015 YouCompleteMe Contributors # Copyright (C) 2015-2016 YouCompleteMe Contributors
# #
# This file is part of YouCompleteMe. # This file is part of YouCompleteMe.
# #
@ -24,7 +24,7 @@ standard_library.install_aliases()
from builtins import * # noqa from builtins import * # noqa
from nose.tools import eq_ from nose.tools import eq_
from ycm.test_utils import MockVimModule from ycm.tests.test_utils import MockVimModule
vim_mock = MockVimModule() vim_mock = MockVimModule()
from .. import completion_request from .. import completion_request

View File

@ -23,7 +23,7 @@ from future import standard_library
standard_library.install_aliases() standard_library.install_aliases()
from builtins import * # noqa from builtins import * # noqa
from ycm.test_utils import MockVimModule from ycm.tests.test_utils import MockVimModule
MockVimModule() MockVimModule()
import functools import functools

View File

@ -1,6 +1,7 @@
# coding: utf-8 # coding: utf-8
# #
# Copyright (C) 2013 Google Inc. # Copyright (C) 2013 Google Inc.
# 2016 YouCompleteMe contributors
# #
# This file is part of YouCompleteMe. # This file is part of YouCompleteMe.
# #
@ -29,7 +30,7 @@ import contextlib
from nose.tools import eq_, ok_ from nose.tools import eq_, ok_
from mock import patch from mock import patch
from ycm.test_utils import MockVimModule from ycm.tests.test_utils import MockVimModule
vim_mock = MockVimModule() vim_mock = MockVimModule()
from ycm import base from ycm import base

View File

@ -23,7 +23,7 @@ from future import standard_library
standard_library.install_aliases() standard_library.install_aliases()
from builtins import * # noqa from builtins import * # noqa
from ycm.test_utils import ExtendedMock, MockVimModule, VimBuffer from ycm.tests.test_utils import ExtendedMock, MockVimModule, VimBuffer
MockVimModule() MockVimModule()
import contextlib import contextlib

View File

@ -30,10 +30,9 @@ from mock import patch, call
from nose.tools import eq_ from nose.tools import eq_
from hamcrest import contains_string from hamcrest import contains_string
from ycm.test_utils import MockVimModule, ExtendedMock from ycm.tests.test_utils import ExpectedFailure, ExtendedMock, MockVimModule
MockVimModule() MockVimModule()
from ycm.test_utils import ExpectedFailure
from ycm.tests import YouCompleteMeInstance from ycm.tests import YouCompleteMeInstance
from ycmd.utils import ToBytes from ycmd.utils import ToBytes
@ -52,9 +51,9 @@ def ToBytesOnPY2( data ):
def BuildRequest( line_num, column_num, contents ): def BuildRequest( line_num, column_num, contents ):
# Note: it would be nice to use ycmd.test_utils.BuildRequest directly here, # Note: it would be nice to use ycmd.tests.test_utils.BuildRequest directly
# but we can't import ycmd.test_utils because that in turn imports ycm_core, # here, but we can't import ycmd.tests.test_utils because that in turn imports
# which would cause our "ycm_core not imported" test to fail. # ycm_core, which would cause our "ycm_core not imported" test to fail.
return { return {
'line_num': line_num, 'line_num': line_num,
'column_num': column_num, 'column_num': column_num,

View File

@ -23,7 +23,7 @@ from future import standard_library
standard_library.install_aliases() standard_library.install_aliases()
from builtins import * # noqa from builtins import * # noqa
from ycm.test_utils import MockVimModule from ycm.tests.test_utils import MockVimModule
MockVimModule() MockVimModule()
from nose.tools import ok_ from nose.tools import ok_

View File

@ -25,7 +25,7 @@ from future import standard_library
standard_library.install_aliases() standard_library.install_aliases()
from builtins import * # noqa from builtins import * # noqa
from ycm.test_utils import MockVimModule from ycm.tests.test_utils import MockVimModule
MockVimModule() MockVimModule()
import contextlib import contextlib

View File

@ -1,4 +1,5 @@
# Copyright (C) 2013 Google Inc. # Copyright (C) 2013 Google Inc.
# 2016 YouCompleteMe contributors
# #
# This file is part of YouCompleteMe. # This file is part of YouCompleteMe.
# #
@ -23,7 +24,7 @@ from future import standard_library
standard_library.install_aliases() standard_library.install_aliases()
from builtins import * # noqa from builtins import * # noqa
from ycm.test_utils import MockVimModule from ycm.tests.test_utils import MockVimModule
MockVimModule() MockVimModule()
import os import os

View File

@ -1,4 +1,5 @@
# Copyright (C) 2011, 2012 Google Inc. # Copyright (C) 2011-2012 Google Inc.
# 2016 YouCompleteMe contributors
# #
# This file is part of YouCompleteMe. # This file is part of YouCompleteMe.
# #
@ -182,7 +183,7 @@ def MockVimModule():
mock module, to ensure that the state of the vim mock is returned before the mock module, to ensure that the state of the vim mock is returned before the
next test. That is: next test. That is:
from ycm.test_utils import MockVimModule from ycm.tests.test_utils import MockVimModule
from mock import patch from mock import patch
# Do this once # Do this once
@ -209,7 +210,7 @@ class ExtendedMock( MagicMock ):
callable is called with a precise set of calls in a precise order. callable is called with a precise set of calls in a precise order.
Example Usage: Example Usage:
from ycm.test_utils import ExtendedMock from ycm.tests.test_utils import ExtendedMock
@patch( 'test.testing', new_callable = ExtendedMock, ... ) @patch( 'test.testing', new_callable = ExtendedMock, ... )
def my_test( test_testing ): def my_test( test_testing ):
... ...

View File

@ -1,6 +1,6 @@
# coding: utf-8 # coding: utf-8
# #
# Copyright (C) 2015 YouCompleteMe contributors # Copyright (C) 2015-2016 YouCompleteMe contributors
# #
# This file is part of YouCompleteMe. # This file is part of YouCompleteMe.
# #
@ -25,8 +25,8 @@ from future import standard_library
standard_library.install_aliases() standard_library.install_aliases()
from builtins import * # noqa from builtins import * # noqa
from ycm.test_utils import ( ExtendedMock, MockVimCommand, VimBuffer, from ycm.tests.test_utils import ( ExtendedMock, MockVimCommand, VimBuffer,
MockVimModule ) MockVimModule )
MockVimModule() MockVimModule()
from ycm import vimsupport from ycm import vimsupport

View File

@ -23,7 +23,7 @@ from future import standard_library
standard_library.install_aliases() standard_library.install_aliases()
from builtins import * # noqa from builtins import * # noqa
from ycm.test_utils import MockVimModule from ycm.tests.test_utils import MockVimModule
MockVimModule() MockVimModule()
import sys import sys