Mercurial > kallithea
changeset 5058:c5829bc7d090
Merge
author | Andrew Shadura <andrew@shadura.me> |
---|---|
date | Thu, 23 Apr 2015 09:03:53 +0200 |
parents | 1c3f8bbc3584 (current diff) 9dd17228c0dc (diff) |
children | d741b99effdf |
files | |
diffstat | 15 files changed, 53 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/tests/api/api_base.py Thu Apr 23 09:03:37 2015 +0200 +++ b/kallithea/tests/api/api_base.py Thu Apr 23 09:03:53 2015 +0200 @@ -88,7 +88,7 @@ return gr -class BaseTestApi(object): +class _BaseTestApi(object): REPO = None REPO_TYPE = None
--- a/kallithea/tests/api/test_api_git.py Thu Apr 23 09:03:37 2015 +0200 +++ b/kallithea/tests/api/test_api_git.py Thu Apr 23 09:03:53 2015 +0200 @@ -12,10 +12,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from kallithea.tests import * -from kallithea.tests.api.api_base import BaseTestApi +from kallithea.tests import TestController, GIT_REPO +from kallithea.tests.api.api_base import _BaseTestApi -class TestGitApi(BaseTestApi, TestController): +class TestGitApi(_BaseTestApi, TestController): REPO = GIT_REPO REPO_TYPE = 'git'
--- a/kallithea/tests/api/test_api_hg.py Thu Apr 23 09:03:37 2015 +0200 +++ b/kallithea/tests/api/test_api_hg.py Thu Apr 23 09:03:53 2015 +0200 @@ -12,10 +12,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -from kallithea.tests import * -from kallithea.tests.api.api_base import BaseTestApi +from kallithea.tests import TestController, HG_REPO +from kallithea.tests.api.api_base import _BaseTestApi -class TestHgApi(BaseTestApi, TestController): +class TestHgApi(_BaseTestApi, TestController): REPO = HG_REPO REPO_TYPE = 'hg'
--- a/kallithea/tests/functional/test_admin_repos.py Thu Apr 23 09:03:37 2015 +0200 +++ b/kallithea/tests/functional/test_admin_repos.py Thu Apr 23 09:03:53 2015 +0200 @@ -26,7 +26,7 @@ return perm -class _BaseTest(TestController): +class _BaseTest(object): """ Write all tests here """ @@ -638,7 +638,7 @@ # repo must not be in filesystem ! self.assertFalse(os.path.isdir(os.path.join(TESTS_TMP_PATH, repo_name))) -class TestAdminReposControllerGIT(_BaseTest): +class TestAdminReposControllerGIT(TestController, _BaseTest): REPO = GIT_REPO REPO_TYPE = 'git' NEW_REPO = NEW_GIT_REPO @@ -646,7 +646,7 @@ OTHER_TYPE = 'hg' -class TestAdminReposControllerHG(_BaseTest): +class TestAdminReposControllerHG(TestController, _BaseTest): REPO = HG_REPO REPO_TYPE = 'hg' NEW_REPO = NEW_HG_REPO
--- a/kallithea/tests/functional/test_forks.py Thu Apr 23 09:03:37 2015 +0200 +++ b/kallithea/tests/functional/test_forks.py Thu Apr 23 09:03:53 2015 +0200 @@ -1,4 +1,7 @@ # -*- coding: utf-8 -*- + +import unittest + from kallithea.tests import * from kallithea.tests.fixture import Fixture @@ -12,15 +15,7 @@ from kallithea.tests import * -class _BaseTest(TestController): - """ - Write all tests here - """ - REPO = None - REPO_TYPE = None - NEW_REPO = None - REPO_FORK = None - +class _BaseFixture(unittest.TestCase): @classmethod def setup_class(cls): pass @@ -40,6 +35,16 @@ Session().delete(self.u1) Session().commit() + +class _BaseTestCase(object): + """ + Write all tests here + """ + REPO = None + REPO_TYPE = None + NEW_REPO = None + REPO_FORK = None + def test_index(self): self.log_user() repo_name = self.REPO @@ -218,14 +223,14 @@ response.mustcontain('There are no forks yet') -class TestGIT(_BaseTest): +class TestGIT(TestController, _BaseTestCase, _BaseFixture): REPO = GIT_REPO NEW_REPO = NEW_GIT_REPO REPO_TYPE = 'git' REPO_FORK = GIT_FORK -class TestHG(_BaseTest): +class TestHG(TestController, _BaseTestCase, _BaseFixture): REPO = HG_REPO NEW_REPO = NEW_HG_REPO REPO_TYPE = 'hg'
--- a/kallithea/tests/vcs/base.py Thu Apr 23 09:03:37 2015 +0200 +++ b/kallithea/tests/vcs/base.py Thu Apr 23 09:03:53 2015 +0200 @@ -13,7 +13,7 @@ from kallithea.lib.vcs.nodes import FileNode -class BackendTestMixin(object): +class _BackendTestMixin(object): """ This is a backend independent test case class which should be created with ``type`` method. @@ -103,7 +103,7 @@ 'backend_alias': alias, } cls_name = ''.join(('%s base backend test' % alias).title().split()) - bases = (BackendTestMixin, unittest.TestCase) + bases = (_BackendTestMixin, unittest.TestCase) globals()[cls_name] = type(cls_name, bases, attrs)
--- a/kallithea/tests/vcs/test_archives.py Thu Apr 23 09:03:37 2015 +0200 +++ b/kallithea/tests/vcs/test_archives.py Thu Apr 23 09:03:53 2015 +0200 @@ -6,14 +6,14 @@ import datetime import tempfile import StringIO -from kallithea.tests.vcs.base import BackendTestMixin +from kallithea.tests.vcs.base import _BackendTestMixin from kallithea.tests.vcs.conf import SCM_TESTS 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): +class ArchivesTestCaseMixin(_BackendTestMixin): @classmethod def _get_commits(cls):
--- a/kallithea/tests/vcs/test_branches.py Thu Apr 23 09:03:37 2015 +0200 +++ b/kallithea/tests/vcs/test_branches.py Thu Apr 23 09:03:53 2015 +0200 @@ -5,11 +5,11 @@ from kallithea.lib.vcs.utils.compat import unittest from kallithea.lib.vcs.nodes import FileNode -from kallithea.tests.vcs.base import BackendTestMixin +from kallithea.tests.vcs.base import _BackendTestMixin from kallithea.tests.vcs.conf import SCM_TESTS -class BranchesTestCaseMixin(BackendTestMixin): +class BranchesTestCaseMixin(_BackendTestMixin): @classmethod def _get_commits(cls):
--- a/kallithea/tests/vcs/test_changesets.py Thu Apr 23 09:03:37 2015 +0200 +++ b/kallithea/tests/vcs/test_changesets.py Thu Apr 23 09:03:53 2015 +0200 @@ -4,7 +4,7 @@ import time import datetime from kallithea.lib import vcs -from kallithea.tests.vcs.base import BackendTestMixin +from kallithea.tests.vcs.base import _BackendTestMixin from kallithea.tests.vcs.conf import SCM_TESTS from kallithea.lib.vcs.backends.base import BaseChangeset @@ -50,7 +50,7 @@ 'removed': [], }) -class ChangesetsWithCommitsTestCaseixin(BackendTestMixin): +class _ChangesetsWithCommitsTestCaseixin(_BackendTestMixin): recreate_repo_per_test = True @classmethod @@ -146,7 +146,7 @@ self.assertEqual([sha], self.repo.get_changeset(test_rev).children) -class ChangesetsTestCaseMixin(BackendTestMixin): +class _ChangesetsTestCaseMixin(_BackendTestMixin): recreate_repo_per_test = False @classmethod @@ -301,7 +301,7 @@ list(self.repo.get_changesets(start=last-1, end=0)) -class ChangesetsChangesTestCaseMixin(BackendTestMixin): +class _ChangesetsChangesTestCaseMixin(_BackendTestMixin): recreate_repo_per_test = False @classmethod @@ -373,17 +373,17 @@ } # tests with additional commits cls_name = ''.join(('%s changesets with commits test' % alias).title().split()) - bases = (ChangesetsWithCommitsTestCaseixin, unittest.TestCase) + bases = (_ChangesetsWithCommitsTestCaseixin, unittest.TestCase) globals()[cls_name] = type(cls_name, bases, attrs) # tests without additional commits cls_name = ''.join(('%s changesets test' % alias).title().split()) - bases = (ChangesetsTestCaseMixin, unittest.TestCase) + bases = (_ChangesetsTestCaseMixin, unittest.TestCase) globals()[cls_name] = type(cls_name, bases, attrs) # tests changes cls_name = ''.join(('%s changesets changes test' % alias).title().split()) - bases = (ChangesetsChangesTestCaseMixin, unittest.TestCase) + bases = (_ChangesetsChangesTestCaseMixin, unittest.TestCase) globals()[cls_name] = type(cls_name, bases, attrs)
--- a/kallithea/tests/vcs/test_getitem.py Thu Apr 23 09:03:37 2015 +0200 +++ b/kallithea/tests/vcs/test_getitem.py Thu Apr 23 09:03:53 2015 +0200 @@ -1,13 +1,13 @@ from __future__ import with_statement import datetime -from kallithea.tests.vcs.base import BackendTestMixin +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 GetitemTestCaseMixin(BackendTestMixin): +class GetitemTestCaseMixin(_BackendTestMixin): @classmethod def _get_commits(cls):
--- a/kallithea/tests/vcs/test_getslice.py Thu Apr 23 09:03:37 2015 +0200 +++ b/kallithea/tests/vcs/test_getslice.py Thu Apr 23 09:03:53 2015 +0200 @@ -1,13 +1,13 @@ from __future__ import with_statement import datetime -from kallithea.tests.vcs.base import BackendTestMixin +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): +class GetsliceTestCaseMixin(_BackendTestMixin): @classmethod def _get_commits(cls):
--- a/kallithea/tests/vcs/test_git.py Thu Apr 23 09:03:37 2015 +0200 +++ b/kallithea/tests/vcs/test_git.py Thu Apr 23 09:03:53 2015 +0200 @@ -8,7 +8,7 @@ from kallithea.lib.vcs.exceptions import RepositoryError, VCSError, NodeDoesNotExistError from kallithea.lib.vcs.nodes import NodeKind, FileNode, DirNode, NodeState from kallithea.lib.vcs.utils.compat import unittest -from kallithea.tests.vcs.base import BackendTestMixin +from kallithea.tests.vcs.base import _BackendTestMixin from kallithea.tests.vcs.conf import TEST_GIT_REPO, TEST_GIT_REPO_CLONE, get_new_dir @@ -620,7 +620,7 @@ changeset.added -class GitSpecificWithRepoTest(BackendTestMixin, unittest.TestCase): +class GitSpecificWithRepoTest(_BackendTestMixin, unittest.TestCase): backend_alias = 'git' @classmethod @@ -688,7 +688,7 @@ % (3, self.repo._get_revision(0), self.repo._get_revision(1))) -class GitRegressionTest(BackendTestMixin, unittest.TestCase): +class GitRegressionTest(_BackendTestMixin, unittest.TestCase): backend_alias = 'git' @classmethod
--- a/kallithea/tests/vcs/test_repository.py Thu Apr 23 09:03:37 2015 +0200 +++ b/kallithea/tests/vcs/test_repository.py Thu Apr 23 09:03:53 2015 +0200 @@ -1,6 +1,6 @@ from __future__ import with_statement import datetime -from kallithea.tests.vcs.base import BackendTestMixin +from kallithea.tests.vcs.base import _BackendTestMixin from kallithea.tests.vcs.conf import SCM_TESTS from kallithea.tests.vcs.conf import TEST_USER_CONFIG_FILE from kallithea.lib.vcs.nodes import FileNode @@ -8,7 +8,7 @@ from kallithea.lib.vcs.exceptions import ChangesetDoesNotExistError -class RepositoryBaseTest(BackendTestMixin): +class RepositoryBaseTest(_BackendTestMixin): recreate_repo_per_test = False @classmethod @@ -46,7 +46,7 @@ self.assertTrue(self.repo != dummy()) -class RepositoryGetDiffTest(BackendTestMixin): +class RepositoryGetDiffTest(_BackendTestMixin): @classmethod def _get_commits(cls):
--- a/kallithea/tests/vcs/test_tags.py Thu Apr 23 09:03:37 2015 +0200 +++ b/kallithea/tests/vcs/test_tags.py Thu Apr 23 09:03:53 2015 +0200 @@ -1,13 +1,13 @@ from __future__ import with_statement -from kallithea.tests.vcs.base import BackendTestMixin +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): +class TagsTestCaseMixin(_BackendTestMixin): def test_new_tag(self): tip = self.repo.get_changeset()
--- a/kallithea/tests/vcs/test_workdirs.py Thu Apr 23 09:03:37 2015 +0200 +++ b/kallithea/tests/vcs/test_workdirs.py Thu Apr 23 09:03:53 2015 +0200 @@ -3,11 +3,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.base import _BackendTestMixin from kallithea.tests.vcs.conf import SCM_TESTS -class WorkdirTestCaseMixin(BackendTestMixin): +class WorkdirTestCaseMixin(_BackendTestMixin): @classmethod def _get_commits(cls):