annotate kallithea/tests/vcs/test_repository.py @ 7120:8f30206a15b5

tests: convert remaining vcs tests to py.test
author Branko Majic <branko@majic.rs>
date Sat, 03 Feb 2018 11:12:13 +0100
parents 5c9eb37bdec4
children 8f3469917832
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
1 import datetime
7117
5c9eb37bdec4 tests: cleanup imports
Branko Majic <branko@majic.rs>
parents: 7116
diff changeset
2
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
3 import pytest
7117
5c9eb37bdec4 tests: cleanup imports
Branko Majic <branko@majic.rs>
parents: 7116
diff changeset
4
5c9eb37bdec4 tests: cleanup imports
Branko Majic <branko@majic.rs>
parents: 7116
diff changeset
5 from kallithea.lib.vcs.nodes import FileNode
5c9eb37bdec4 tests: cleanup imports
Branko Majic <branko@majic.rs>
parents: 7116
diff changeset
6 from kallithea.lib.vcs.exceptions import ChangesetDoesNotExistError
5c9eb37bdec4 tests: cleanup imports
Branko Majic <branko@majic.rs>
parents: 7116
diff changeset
7
5051
12ae08b2fe3f tests: avoid executing tests in base classes
Marc Abramowitz <marc@marc-abramowitz.com>
parents: 4187
diff changeset
8 from kallithea.tests.vcs.base import _BackendTestMixin
4186
7e5f8c12a3fc First step in two-part process to rename directories to kallithea.
Bradley M. Kuhn <bkuhn@sfconservancy.org>
parents: 3960
diff changeset
9 from kallithea.tests.vcs.conf import SCM_TESTS
7116
191d377abad0 tests: cleanup vcs aconfig setup - move setup to setup_package
Branko Majic <branko@majic.rs>
parents: 7112
diff changeset
10 from kallithea.tests.vcs import TEST_USER_CONFIG_FILE
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
11
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
12
5051
12ae08b2fe3f tests: avoid executing tests in base classes
Marc Abramowitz <marc@marc-abramowitz.com>
parents: 4187
diff changeset
13 class RepositoryBaseTest(_BackendTestMixin):
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
14 recreate_repo_per_test = False
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
15
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
16 @classmethod
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
17 def _get_commits(cls):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
18 return super(RepositoryBaseTest, cls)._get_commits()[:1]
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
19
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
20 def test_get_config_value(self):
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
21 assert self.repo.get_config_value('universal', 'foo', TEST_USER_CONFIG_FILE) == 'bar'
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
22
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
23 def test_get_config_value_defaults_to_None(self):
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
24 assert self.repo.get_config_value('universal', 'nonexist', TEST_USER_CONFIG_FILE) == None
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
25
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
26 def test_get_user_name(self):
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
27 assert self.repo.get_user_name(TEST_USER_CONFIG_FILE) == 'Foo Bar'
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
28
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
29 def test_get_user_email(self):
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
30 assert self.repo.get_user_email(TEST_USER_CONFIG_FILE) == 'foo.bar@example.com'
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
31
3692
5f9f4ece4b52 added __eq__ operation on vcs Repository objects
Marcin Kuzminski <marcin@python-works.com>
parents: 2995
diff changeset
32 def test_repo_equality(self):
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
33 assert self.repo == self.repo
3692
5f9f4ece4b52 added __eq__ operation on vcs Repository objects
Marcin Kuzminski <marcin@python-works.com>
parents: 2995
diff changeset
34
5f9f4ece4b52 added __eq__ operation on vcs Repository objects
Marcin Kuzminski <marcin@python-works.com>
parents: 2995
diff changeset
35 def test_repo_equality_broken_object(self):
5f9f4ece4b52 added __eq__ operation on vcs Repository objects
Marcin Kuzminski <marcin@python-works.com>
parents: 2995
diff changeset
36 import copy
5f9f4ece4b52 added __eq__ operation on vcs Repository objects
Marcin Kuzminski <marcin@python-works.com>
parents: 2995
diff changeset
37 _repo = copy.copy(self.repo)
5f9f4ece4b52 added __eq__ operation on vcs Repository objects
Marcin Kuzminski <marcin@python-works.com>
parents: 2995
diff changeset
38 delattr(_repo, 'path')
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
39 assert self.repo != _repo
3692
5f9f4ece4b52 added __eq__ operation on vcs Repository objects
Marcin Kuzminski <marcin@python-works.com>
parents: 2995
diff changeset
40
5f9f4ece4b52 added __eq__ operation on vcs Repository objects
Marcin Kuzminski <marcin@python-works.com>
parents: 2995
diff changeset
41 def test_repo_equality_other_object(self):
5f9f4ece4b52 added __eq__ operation on vcs Repository objects
Marcin Kuzminski <marcin@python-works.com>
parents: 2995
diff changeset
42 class dummy(object):
5f9f4ece4b52 added __eq__ operation on vcs Repository objects
Marcin Kuzminski <marcin@python-works.com>
parents: 2995
diff changeset
43 path = self.repo.path
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
44 assert self.repo != dummy()
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
45
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
46
5051
12ae08b2fe3f tests: avoid executing tests in base classes
Marc Abramowitz <marc@marc-abramowitz.com>
parents: 4187
diff changeset
47 class RepositoryGetDiffTest(_BackendTestMixin):
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
48
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
49 @classmethod
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
50 def _get_commits(cls):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
51 commits = [
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
52 {
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
53 'message': 'Initial commit',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
54 'author': 'Joe Doe <joe.doe@example.com>',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
55 'date': datetime.datetime(2010, 1, 1, 20),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
56 'added': [
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
57 FileNode('foobar', content='foobar'),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
58 FileNode('foobar2', content='foobar2'),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
59 ],
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
60 },
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
61 {
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
62 'message': 'Changed foobar, added foobar3',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
63 'author': 'Jane Doe <jane.doe@example.com>',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
64 'date': datetime.datetime(2010, 1, 1, 21),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
65 'added': [
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
66 FileNode('foobar3', content='foobar3'),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
67 ],
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
68 'changed': [
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
69 FileNode('foobar', 'FOOBAR'),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
70 ],
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
71 },
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
72 {
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
73 'message': 'Removed foobar, changed foobar3',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
74 'author': 'Jane Doe <jane.doe@example.com>',
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
75 'date': datetime.datetime(2010, 1, 1, 22),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
76 'changed': [
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
77 FileNode('foobar3', content='FOOBAR\nFOOBAR\nFOOBAR\n'),
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
78 ],
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
79 'removed': [FileNode('foobar')],
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
80 },
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
81 ]
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
82 return commits
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
83
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
84 def test_raise_for_wrong(self):
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
85 with pytest.raises(ChangesetDoesNotExistError):
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
86 self.repo.get_diff('a' * 40, 'b' * 40)
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
87
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
88
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
89 class TestGitRepositoryGetDiff(RepositoryGetDiffTest):
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
90 backend_alias = 'git'
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
91
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
92 def test_initial_commit_diff(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
93 initial_rev = self.repo.revisions[0]
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
94 assert self.repo.get_diff(self.repo.EMPTY_CHANGESET, initial_rev) == '''diff --git a/foobar b/foobar
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
95 new file mode 100644
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
96 index 0000000000000000000000000000000000000000..f6ea0495187600e7b2288c8ac19c5886383a4632
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
97 --- /dev/null
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
98 +++ b/foobar
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
99 @@ -0,0 +1 @@
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
100 +foobar
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
101 \ No newline at end of file
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
102 diff --git a/foobar2 b/foobar2
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
103 new file mode 100644
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
104 index 0000000000000000000000000000000000000000..e8c9d6b98e3dce993a464935e1a53f50b56a3783
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
105 --- /dev/null
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
106 +++ b/foobar2
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
107 @@ -0,0 +1 @@
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
108 +foobar2
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
109 \ No newline at end of file
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
110 '''
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
111
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
112 def test_second_changeset_diff(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
113 revs = self.repo.revisions
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
114 assert self.repo.get_diff(revs[0], revs[1]) == '''diff --git a/foobar b/foobar
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
115 index f6ea0495187600e7b2288c8ac19c5886383a4632..389865bb681b358c9b102d79abd8d5f941e96551 100644
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
116 --- a/foobar
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
117 +++ b/foobar
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
118 @@ -1 +1 @@
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
119 -foobar
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
120 \ No newline at end of file
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
121 +FOOBAR
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
122 \ No newline at end of file
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
123 diff --git a/foobar3 b/foobar3
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
124 new file mode 100644
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
125 index 0000000000000000000000000000000000000000..c11c37d41d33fb47741cff93fa5f9d798c1535b0
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
126 --- /dev/null
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
127 +++ b/foobar3
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
128 @@ -0,0 +1 @@
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
129 +foobar3
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
130 \ No newline at end of file
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
131 '''
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
132
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
133 def test_third_changeset_diff(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
134 revs = self.repo.revisions
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
135 assert self.repo.get_diff(revs[1], revs[2]) == '''diff --git a/foobar b/foobar
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
136 deleted file mode 100644
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
137 index 389865bb681b358c9b102d79abd8d5f941e96551..0000000000000000000000000000000000000000
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
138 --- a/foobar
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
139 +++ /dev/null
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
140 @@ -1 +0,0 @@
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
141 -FOOBAR
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
142 \ No newline at end of file
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
143 diff --git a/foobar3 b/foobar3
2995
32471bd1f4ee Implemented generation of changesets based
Marcin Kuzminski <marcin@python-works.com>
parents: 2451
diff changeset
144 index c11c37d41d33fb47741cff93fa5f9d798c1535b0..f9324477362684ff692aaf5b9a81e01b9e9a671c 100644
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
145 --- a/foobar3
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
146 +++ b/foobar3
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
147 @@ -1 +1,3 @@
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
148 -foobar3
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
149 \ No newline at end of file
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
150 +FOOBAR
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
151 +FOOBAR
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
152 +FOOBAR
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
153 '''
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
154
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
155
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
156 class TestHgRepositoryGetDiff(RepositoryGetDiffTest):
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
157 backend_alias = 'hg'
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
158
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
159 def test_initial_commit_diff(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
160 initial_rev = self.repo.revisions[0]
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
161 assert self.repo.get_diff(self.repo.EMPTY_CHANGESET, initial_rev) == '''diff --git a/foobar b/foobar
3838
dbe9a08b2bcf fixed VCS tests after executable big issue was fixed
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
162 new file mode 100644
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
163 --- /dev/null
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
164 +++ b/foobar
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
165 @@ -0,0 +1,1 @@
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
166 +foobar
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
167 \ No newline at end of file
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
168 diff --git a/foobar2 b/foobar2
3838
dbe9a08b2bcf fixed VCS tests after executable big issue was fixed
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
169 new file mode 100644
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
170 --- /dev/null
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
171 +++ b/foobar2
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
172 @@ -0,0 +1,1 @@
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
173 +foobar2
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
174 \ No newline at end of file
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
175 '''
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
176
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
177 def test_second_changeset_diff(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
178 revs = self.repo.revisions
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
179 assert self.repo.get_diff(revs[0], revs[1]) == '''diff --git a/foobar b/foobar
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
180 --- a/foobar
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
181 +++ b/foobar
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
182 @@ -1,1 +1,1 @@
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
183 -foobar
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
184 \ No newline at end of file
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
185 +FOOBAR
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
186 \ No newline at end of file
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
187 diff --git a/foobar3 b/foobar3
3838
dbe9a08b2bcf fixed VCS tests after executable big issue was fixed
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
188 new file mode 100644
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
189 --- /dev/null
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
190 +++ b/foobar3
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
191 @@ -0,0 +1,1 @@
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
192 +foobar3
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
193 \ No newline at end of file
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
194 '''
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
195
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
196 def test_third_changeset_diff(self):
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
197 revs = self.repo.revisions
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
198 assert self.repo.get_diff(revs[1], revs[2]) == '''diff --git a/foobar b/foobar
3838
dbe9a08b2bcf fixed VCS tests after executable big issue was fixed
Marcin Kuzminski <marcin@python-works.com>
parents: 3797
diff changeset
199 deleted file mode 100644
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
200 --- a/foobar
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
201 +++ /dev/null
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
202 @@ -1,1 +0,0 @@
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
203 -FOOBAR
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
204 \ No newline at end of file
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
205 diff --git a/foobar3 b/foobar3
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
206 --- a/foobar3
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
207 +++ b/foobar3
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
208 @@ -1,1 +1,3 @@
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
209 -foobar3
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
210 \ No newline at end of file
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
211 +FOOBAR
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
212 +FOOBAR
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
213 +FOOBAR
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
214 '''
2451
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
215
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
216
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
217 # For each backend create test case class
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
218 for alias in SCM_TESTS:
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
219 attrs = {
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
220 'backend_alias': alias,
402a96fcfa22 Added vcs testsuite for better integration tests + added fetching
Marcin Kuzminski <marcin@python-works.com>
parents:
diff changeset
221 }
7120
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
222 cls_name = 'Test' + alias.capitalize() + RepositoryBaseTest.__name__
8f30206a15b5 tests: convert remaining vcs tests to py.test
Branko Majic <branko@majic.rs>
parents: 7117
diff changeset
223 globals()[cls_name] = type(cls_name, (RepositoryBaseTest,), attrs)