Mercurial > kallithea
changeset 7117:5c9eb37bdec4
tests: cleanup imports
author | Branko Majic <branko@majic.rs> |
---|---|
date | Sat, 10 Feb 2018 17:50:02 +0100 |
parents | 191d377abad0 |
children | 4c46ebbcf814 |
files | kallithea/tests/vcs/__init__.py kallithea/tests/vcs/base.py kallithea/tests/vcs/conf.py kallithea/tests/vcs/test_archives.py kallithea/tests/vcs/test_changesets.py kallithea/tests/vcs/test_filenodes_unicode_path.py kallithea/tests/vcs/test_getitem.py kallithea/tests/vcs/test_getslice.py kallithea/tests/vcs/test_git.py kallithea/tests/vcs/test_hg.py kallithea/tests/vcs/test_inmemchangesets.py kallithea/tests/vcs/test_nodes.py kallithea/tests/vcs/test_repository.py kallithea/tests/vcs/test_tags.py kallithea/tests/vcs/test_utils.py kallithea/tests/vcs/test_vcs.py kallithea/tests/vcs/test_workdirs.py |
diffstat | 17 files changed, 58 insertions(+), 41 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/tests/vcs/__init__.py Wed Feb 07 01:35:26 2018 +0100 +++ b/kallithea/tests/vcs/__init__.py Sat Feb 10 17:50:02 2018 +0100 @@ -6,28 +6,20 @@ ``vcs.backends.BACKENDS``. For each SCM we run tests for, we need some repository. We would use -repositories location from system environment variables or test suite defaults -- see ``conf`` module for more detail. We simply try to check if repository at -certain location exists, if not we would try to fetch them. At ``test_vcs`` or -``test_common`` we run unit tests common for each repository type and for -example specific mercurial tests are located at ``test_hg`` module. - -Oh, and tests are run with ``unittest.collector`` wrapped by ``collector`` -function at ``tests/__init__.py``. - -.. _vcs: http://bitbucket.org/marcinkuzminski/vcs -.. _unittest: http://pypi.python.org/pypi/unittest - +repositories location provided in test suite defaults - see ``conf`` +module for more detail. We simply try to check if repository at +certain location exists, if not we would try to fetch them. At +``test_vcs`` or ``test_common`` we run unit tests common for each +repository type and for example specific mercurial tests are located +at ``test_hg`` module. """ import os import shutil -from kallithea.tests.base import TEST_HG_REPO, HG_REMOTE_REPO, TEST_GIT_REPO, GIT_REMOTE_REPO +from kallithea.tests.base import TEST_HG_REPO, HG_REMOTE_REPO, TEST_GIT_REPO, GIT_REMOTE_REPO, TESTS_TMP_PATH from kallithea.tests.vcs.utils import SCMFetcher -from kallithea.tests.base import * - # Base directory for the VCS tests. VCS_TEST_MODULE_BASE_DIR = os.path.abspath(os.path.dirname(__file__))
--- a/kallithea/tests/vcs/base.py Wed Feb 07 01:35:26 2018 +0100 +++ b/kallithea/tests/vcs/base.py Sat Feb 10 17:50:02 2018 +0100 @@ -6,12 +6,13 @@ import time import shutil import datetime -from kallithea.tests.vcs.conf import SCM_TESTS, get_new_dir from kallithea.lib import vcs from kallithea.lib.vcs.utils.compat import unittest from kallithea.lib.vcs.nodes import FileNode +from kallithea.tests.vcs.conf import SCM_TESTS, get_new_dir + class _BackendTestMixin(object): """
--- a/kallithea/tests/vcs/conf.py Wed Feb 07 01:35:26 2018 +0100 +++ b/kallithea/tests/vcs/conf.py Sat Feb 10 17:50:02 2018 +0100 @@ -10,11 +10,14 @@ from kallithea.tests.base import ( TESTS_TMP_PATH, SCM_TESTS, TEST_HG_REPO, HG_REMOTE_REPO, + TEST_HG_REPO_CLONE, TEST_HG_REPO_PULL, TEST_GIT_REPO, GIT_REMOTE_REPO, + TEST_GIT_REPO_CLONE, ) __all__ = ( 'TEST_HG_REPO', 'TEST_GIT_REPO', 'HG_REMOTE_REPO', 'GIT_REMOTE_REPO', + 'TEST_HG_REPO_CLONE', 'TEST_GIT_REPO_CLONE', 'TEST_HG_REPO_PULL', 'SCM_TESTS', ) @@ -54,7 +57,3 @@ hex_uuid = uuid.uuid4().hex return "%s-%s" % (path, hex_uuid) - - -# overide default configurations with kallithea ones -from kallithea.tests.base import *
--- a/kallithea/tests/vcs/test_archives.py Wed Feb 07 01:35:26 2018 +0100 +++ b/kallithea/tests/vcs/test_archives.py Sat Feb 10 17:50:02 2018 +0100 @@ -5,11 +5,13 @@ import tempfile import StringIO +from kallithea.lib.vcs.utils.compat import unittest + +from kallithea.lib.vcs.exceptions import VCSError +from kallithea.lib.vcs.nodes import FileNode + from kallithea.tests.vcs.base import _BackendTestMixin from kallithea.tests.vcs.conf import SCM_TESTS, TESTS_TMP_PATH -from kallithea.lib.vcs.exceptions import VCSError -from kallithea.lib.vcs.nodes import FileNode -from kallithea.lib.vcs.utils.compat import unittest class ArchivesTestCaseMixin(_BackendTestMixin):
--- a/kallithea/tests/vcs/test_changesets.py Wed Feb 07 01:35:26 2018 +0100 +++ b/kallithea/tests/vcs/test_changesets.py Sat Feb 10 17:50:02 2018 +0100 @@ -2,9 +2,10 @@ import time import datetime + +from kallithea.lib.vcs.utils.compat import unittest + from kallithea.lib import vcs -from kallithea.tests.vcs.base import _BackendTestMixin -from kallithea.tests.vcs.conf import SCM_TESTS from kallithea.lib.vcs.backends.base import BaseChangeset from kallithea.lib.vcs.nodes import ( @@ -15,8 +16,9 @@ BranchDoesNotExistError, ChangesetDoesNotExistError, RepositoryError, EmptyRepositoryError ) -from kallithea.lib.vcs.utils.compat import unittest -from kallithea.tests.vcs.conf import get_new_dir + +from kallithea.tests.vcs.base import _BackendTestMixin +from kallithea.tests.vcs.conf import SCM_TESTS, get_new_dir class TestBaseChangeset(unittest.TestCase):
--- a/kallithea/tests/vcs/test_filenodes_unicode_path.py Wed Feb 07 01:35:26 2018 +0100 +++ b/kallithea/tests/vcs/test_filenodes_unicode_path.py Sat Feb 10 17:50:02 2018 +0100 @@ -1,7 +1,7 @@ # encoding: utf8 +import datetime -import datetime from kallithea.lib.vcs.nodes import FileNode from kallithea.tests.vcs.test_inmemchangesets import BackendBaseTestCase from kallithea.tests.vcs.conf import SCM_TESTS
--- a/kallithea/tests/vcs/test_getitem.py Wed Feb 07 01:35:26 2018 +0100 +++ b/kallithea/tests/vcs/test_getitem.py Sat Feb 10 17:50:02 2018 +0100 @@ -1,4 +1,5 @@ import datetime + from kallithea.tests.vcs.base import _BackendTestMixin from kallithea.tests.vcs.conf import SCM_TESTS from kallithea.lib.vcs.nodes import FileNode
--- a/kallithea/tests/vcs/test_getslice.py Wed Feb 07 01:35:26 2018 +0100 +++ b/kallithea/tests/vcs/test_getslice.py Sat Feb 10 17:50:02 2018 +0100 @@ -1,8 +1,11 @@ import datetime + +from kallithea.lib.vcs.nodes import FileNode + +from kallithea.lib.vcs.utils.compat import unittest + from kallithea.tests.vcs.base import _BackendTestMixin from kallithea.tests.vcs.conf import SCM_TESTS -from kallithea.lib.vcs.nodes import FileNode -from kallithea.lib.vcs.utils.compat import unittest class GetsliceTestCaseMixin(_BackendTestMixin):
--- a/kallithea/tests/vcs/test_git.py Wed Feb 07 01:35:26 2018 +0100 +++ b/kallithea/tests/vcs/test_git.py Sat Feb 10 17:50:02 2018 +0100 @@ -11,6 +11,7 @@ from kallithea.lib.vcs.nodes import NodeKind, FileNode, DirNode, NodeState from kallithea.lib.vcs.utils.compat import unittest from kallithea.model.scm import ScmModel + from kallithea.tests.vcs.base import _BackendTestMixin from kallithea.tests.vcs.conf import TEST_GIT_REPO, TEST_GIT_REPO_CLONE, TESTS_TMP_PATH, get_new_dir
--- a/kallithea/tests/vcs/test_hg.py Wed Feb 07 01:35:26 2018 +0100 +++ b/kallithea/tests/vcs/test_hg.py Sat Feb 10 17:50:02 2018 +0100 @@ -6,6 +6,7 @@ from kallithea.lib.vcs.backends.hg import MercurialRepository, MercurialChangeset from kallithea.lib.vcs.exceptions import RepositoryError, VCSError, NodeDoesNotExistError from kallithea.lib.vcs.nodes import NodeKind, NodeState + from kallithea.tests.vcs.conf import TEST_HG_REPO, TEST_HG_REPO_CLONE, \ TEST_HG_REPO_PULL, TESTS_TMP_PATH from kallithea.lib.vcs.utils.compat import unittest
--- a/kallithea/tests/vcs/test_inmemchangesets.py Wed Feb 07 01:35:26 2018 +0100 +++ b/kallithea/tests/vcs/test_inmemchangesets.py Sat Feb 10 17:50:02 2018 +0100 @@ -6,8 +6,9 @@ import time import datetime +from kallithea.lib.vcs.utils.compat import unittest + from kallithea.lib import vcs -from kallithea.tests.vcs.conf import SCM_TESTS, get_new_dir from kallithea.lib.vcs.exceptions import EmptyRepositoryError from kallithea.lib.vcs.exceptions import NodeAlreadyAddedError from kallithea.lib.vcs.exceptions import NodeAlreadyExistsError @@ -17,9 +18,10 @@ from kallithea.lib.vcs.exceptions import NodeNotChangedError from kallithea.lib.vcs.nodes import DirNode from kallithea.lib.vcs.nodes import FileNode -from kallithea.lib.vcs.utils.compat import unittest from kallithea.lib.vcs.utils import safe_unicode +from kallithea.tests.vcs.conf import SCM_TESTS, get_new_dir + class InMemoryChangesetTestMixin(object): """
--- a/kallithea/tests/vcs/test_nodes.py Wed Feb 07 01:35:26 2018 +0100 +++ b/kallithea/tests/vcs/test_nodes.py Sat Feb 10 17:50:02 2018 +0100 @@ -1,11 +1,13 @@ import stat import mimetypes + +from kallithea.lib.vcs.utils.compat import unittest + from kallithea.lib.vcs.nodes import DirNode from kallithea.lib.vcs.nodes import FileNode from kallithea.lib.vcs.nodes import Node from kallithea.lib.vcs.nodes import NodeError from kallithea.lib.vcs.nodes import NodeKind -from kallithea.lib.vcs.utils.compat import unittest class NodeBasicTest(unittest.TestCase):
--- a/kallithea/tests/vcs/test_repository.py Wed Feb 07 01:35:26 2018 +0100 +++ b/kallithea/tests/vcs/test_repository.py Sat Feb 10 17:50:02 2018 +0100 @@ -1,10 +1,13 @@ import datetime + +from kallithea.lib.vcs.utils.compat import unittest + +from kallithea.lib.vcs.nodes import FileNode +from kallithea.lib.vcs.exceptions import ChangesetDoesNotExistError + from kallithea.tests.vcs.base import _BackendTestMixin from kallithea.tests.vcs.conf import SCM_TESTS from kallithea.tests.vcs import TEST_USER_CONFIG_FILE -from kallithea.lib.vcs.nodes import FileNode -from kallithea.lib.vcs.utils.compat import unittest -from kallithea.lib.vcs.exceptions import ChangesetDoesNotExistError class RepositoryBaseTest(_BackendTestMixin):
--- a/kallithea/tests/vcs/test_tags.py Wed Feb 07 01:35:26 2018 +0100 +++ b/kallithea/tests/vcs/test_tags.py Sat Feb 10 17:50:02 2018 +0100 @@ -1,8 +1,10 @@ +from kallithea.lib.vcs.utils.compat import unittest + +from kallithea.lib.vcs.exceptions import TagAlreadyExistError +from kallithea.lib.vcs.exceptions import TagDoesNotExistError + from kallithea.tests.vcs.base import _BackendTestMixin from kallithea.tests.vcs.conf import SCM_TESTS -from kallithea.lib.vcs.exceptions import TagAlreadyExistError -from kallithea.lib.vcs.exceptions import TagDoesNotExistError -from kallithea.lib.vcs.utils.compat import unittest class TagsTestCaseMixin(_BackendTestMixin):
--- a/kallithea/tests/vcs/test_utils.py Wed Feb 07 01:35:26 2018 +0100 +++ b/kallithea/tests/vcs/test_utils.py Sat Feb 10 17:50:02 2018 +0100 @@ -7,6 +7,7 @@ import datetime from kallithea.lib.vcs.utils.compat import unittest + from kallithea.lib.vcs.utils.paths import get_dirs_for_path from kallithea.lib.vcs.utils.helpers import get_dict_for_attrs from kallithea.lib.vcs.utils.helpers import get_scm
--- a/kallithea/tests/vcs/test_vcs.py Wed Feb 07 01:35:26 2018 +0100 +++ b/kallithea/tests/vcs/test_vcs.py Sat Feb 10 17:50:02 2018 +0100 @@ -1,10 +1,12 @@ import os import shutil +from kallithea.lib.vcs.utils.compat import unittest + from kallithea.lib.utils2 import safe_str from kallithea.lib.vcs import VCSError, get_repo, get_backend from kallithea.lib.vcs.backends.hg import MercurialRepository -from kallithea.lib.vcs.utils.compat import unittest + from kallithea.tests.vcs.conf import TEST_HG_REPO, TEST_GIT_REPO, TESTS_TMP_PATH
--- a/kallithea/tests/vcs/test_workdirs.py Wed Feb 07 01:35:26 2018 +0100 +++ b/kallithea/tests/vcs/test_workdirs.py Sat Feb 10 17:50:02 2018 +0100 @@ -1,6 +1,9 @@ import datetime + +from kallithea.lib.vcs.utils.compat import unittest + from kallithea.lib.vcs.nodes import FileNode -from kallithea.lib.vcs.utils.compat import unittest + from kallithea.tests.vcs.base import _BackendTestMixin from kallithea.tests.vcs.conf import SCM_TESTS