##// END OF EJS Templates
deps: bumped webob==1.8.9
deps: bumped webob==1.8.9

File last commit:

r5608:6d33e504 default
r5613:06b67f1b default
Show More
test_commits.py
595 lines | 21.6 KiB | text/x-python | PythonLexer
core: updated copyright to 2024
r5608 # Copyright (C) 2010-2024 RhodeCode GmbH
project: added all source files and assets
r1 #
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License, version 3
# (only), as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This program is dual-licensed. If you wish to learn more about the
# RhodeCode Enterprise Edition, including its added features, Support services,
# and proprietary license terms, please see https://rhodecode.com/licenses/
import datetime
import time
import pytest
tests: fixed all tests for python3 BIG changes
r5087 from rhodecode.lib.str_utils import safe_bytes
tests: fixed test suite for celery adoption
r5607 from rhodecode.lib.vcs.backends.base import CollectionGenerator, FILEMODE_DEFAULT, EmptyCommit
project: added all source files and assets
r1 from rhodecode.lib.vcs.exceptions import (
tests: fixed test suite for celery adoption
r5607 BranchDoesNotExistError,
CommitDoesNotExistError,
RepositoryError,
EmptyRepositoryError,
)
project: added all source files and assets
r1 from rhodecode.lib.vcs.nodes import (
tests: fixed test suite for celery adoption
r5607 FileNode,
AddedFileNodesGenerator,
ChangedFileNodesGenerator,
RemovedFileNodesGenerator,
)
project: added all source files and assets
r1 from rhodecode.tests import get_new_dir
tests: use gunicorn for testing. This is close to production testing...
r2453 from rhodecode.tests.vcs.conftest import BackendTestMixin
project: added all source files and assets
r1
changelog: rename changelog to commits pages
r3742 class TestBaseChangeset(object):
project: added all source files and assets
r1 def test_is_deprecated(self):
from rhodecode.lib.vcs.backends.base import BaseChangeset
tests: fixed test suite for celery adoption
r5607
project: added all source files and assets
r1 pytest.deprecated_call(BaseChangeset)
tests: use gunicorn for testing. This is close to production testing...
r2453 class TestEmptyCommit(object):
project: added all source files and assets
r1 def test_branch_without_alias_returns_none(self):
commit = EmptyCommit()
assert commit.branch is None
tests: use gunicorn for testing. This is close to production testing...
r2453 @pytest.mark.usefixtures("vcs_repository_support")
project: added all source files and assets
r1 class TestCommitsInNonEmptyRepo(BackendTestMixin):
recreate_repo_per_test = True
@classmethod
def _get_commits(cls):
start_date = datetime.datetime(2010, 1, 1, 20)
python3: removed use of xrang
r4906 for x in range(5):
project: added all source files and assets
r1 yield {
tests: fixed test suite for celery adoption
r5607 "message": "Commit %d" % x,
"author": "Joe Doe <joe.doe@example.com>",
"date": start_date + datetime.timedelta(hours=12 * x),
"added": [
FileNode(b"file_%d.txt" % x, content=b"Foobar %d" % x),
project: added all source files and assets
r1 ],
}
def test_walk_returns_empty_list_in_case_of_file(self):
tests: fixed test suite for celery adoption
r5607 result = list(self.tip.walk("file_0.txt"))
project: added all source files and assets
r1 assert result == []
@pytest.mark.backends("git", "hg")
def test_new_branch(self):
tests: fixed test suite for celery adoption
r5607 self.imc.add(FileNode(b"docs/index.txt", content=b"Documentation\n"))
project: added all source files and assets
r1 foobar_tip = self.imc.commit(
tests: fixed test suite for celery adoption
r5607 message="New branch: foobar",
author="joe <joe@rhodecode.com>",
branch="foobar",
project: added all source files and assets
r1 )
tests: fixed test suite for celery adoption
r5607 assert "foobar" in self.repo.branches
assert foobar_tip.branch == "foobar"
project: added all source files and assets
r1 # 'foobar' should be the only branch that contains the new commit
tests: fixed all tests for python3 BIG changes
r5087 branch = list(self.repo.branches.values())
project: added all source files and assets
r1 assert branch[0] != branch[1]
@pytest.mark.backends("git", "hg")
def test_new_head_in_default_branch(self):
tip = self.repo.get_commit()
chore(tests): fixed some broken bad tests
r5225
tests: fixed test suite for celery adoption
r5607 self.imc.add(FileNode(b"docs/index.txt", content=b"Documentation\n"))
project: added all source files and assets
r1 foobar_tip = self.imc.commit(
chore(tests): fixed some broken bad tests
r5225 message="New branch: foobar",
author="joe <joe@rhodecode.com>",
branch="foobar",
project: added all source files and assets
r1 parents=[tip],
)
tests: fixed test suite for celery adoption
r5607 self.imc.change(FileNode(b"docs/index.txt", content=b"Documentation\nand more...\n"))
chore(tests): fixed some broken bad tests
r5225 assert foobar_tip.branch == "foobar"
project: added all source files and assets
r1 newtip = self.imc.commit(
chore(tests): fixed some broken bad tests
r5225 message="At foobar_tip branch",
author="joe <joe@rhodecode.com>",
project: added all source files and assets
r1 branch=foobar_tip.branch,
parents=[foobar_tip],
)
newest_tip = self.imc.commit(
chore(tests): fixed some broken bad tests
r5225 message=f"Merged with {foobar_tip.raw_id}",
author="joe <joe@rhodecode.com>",
project: added all source files and assets
r1 branch=self.backend_class.DEFAULT_BRANCH_NAME,
chore(tests): fixed some broken bad tests
r5225 parents=[tip, newtip],
project: added all source files and assets
r1 )
assert newest_tip.branch == self.backend_class.DEFAULT_BRANCH_NAME
@pytest.mark.backends("git", "hg")
def test_get_commits_respects_branch_name(self):
"""
* e1930d0 (HEAD, master) Back in default branch
| * e1930d0 (docs) New Branch: docs2
| * dcc14fa New branch: docs
|/
* e63c41a Initial commit
...
* 624d3db Commit 0
:return:
"""
DEFAULT_BRANCH = self.repo.DEFAULT_BRANCH_NAME
tests: fixed test suite for celery adoption
r5607 TEST_BRANCH = "docs"
project: added all source files and assets
r1 org_tip = self.repo.get_commit()
tests: fixed test suite for celery adoption
r5607 self.imc.add(FileNode(b"readme.txt", content=b"Document\n"))
project: added all source files and assets
r1 initial = self.imc.commit(
tests: fixed test suite for celery adoption
r5607 message="Initial commit",
author="joe <joe@rhodecode.com>",
project: added all source files and assets
r1 parents=[org_tip],
tests: fixed test suite for celery adoption
r5607 branch=DEFAULT_BRANCH,
)
project: added all source files and assets
r1
tests: fixed test suite for celery adoption
r5607 self.imc.add(FileNode(b"newdoc.txt", content=b"foobar\n"))
project: added all source files and assets
r1 docs_branch_commit1 = self.imc.commit(
tests: fixed test suite for celery adoption
r5607 message="New branch: docs",
author="joe <joe@rhodecode.com>",
project: added all source files and assets
r1 parents=[initial],
tests: fixed test suite for celery adoption
r5607 branch=TEST_BRANCH,
)
project: added all source files and assets
r1
tests: fixed test suite for celery adoption
r5607 self.imc.add(FileNode(b"newdoc2.txt", content=b"foobar2\n"))
project: added all source files and assets
r1 docs_branch_commit2 = self.imc.commit(
tests: fixed test suite for celery adoption
r5607 message="New branch: docs2",
author="joe <joe@rhodecode.com>",
project: added all source files and assets
r1 parents=[docs_branch_commit1],
tests: fixed test suite for celery adoption
r5607 branch=TEST_BRANCH,
)
project: added all source files and assets
r1
tests: fixed test suite for celery adoption
r5607 self.imc.add(FileNode(b"newfile", content=b"hello world\n"))
project: added all source files and assets
r1 self.imc.commit(
tests: fixed test suite for celery adoption
r5607 message="Back in default branch",
author="joe <joe@rhodecode.com>",
project: added all source files and assets
r1 parents=[initial],
tests: fixed test suite for celery adoption
r5607 branch=DEFAULT_BRANCH,
)
project: added all source files and assets
r1
commits: re-implemented fetching a single commit for git case....
r3740 default_branch_commits = self.repo.get_commits(branch_name=DEFAULT_BRANCH)
project: added all source files and assets
r1 assert docs_branch_commit1 not in list(default_branch_commits)
assert docs_branch_commit2 not in list(default_branch_commits)
docs_branch_commits = self.repo.get_commits(
tests: fixed test suite for celery adoption
r5607 start_id=self.repo.commit_ids[0], end_id=self.repo.commit_ids[-1], branch_name=TEST_BRANCH
)
project: added all source files and assets
r1 assert docs_branch_commit1 in list(docs_branch_commits)
assert docs_branch_commit2 in list(docs_branch_commits)
@pytest.mark.backends("svn")
def test_get_commits_respects_branch_name_svn(self, vcsbackend_svn):
tests: fixed test suite for celery adoption
r5607 repo = vcsbackend_svn["svn-simple-layout"]
commits = repo.get_commits(branch_name="trunk")
project: added all source files and assets
r1 commit_indexes = [c.idx for c in commits]
assert commit_indexes == [1, 2, 3, 7, 12, 15]
changelog: rename changelog to commits pages
r3742 def test_get_commit_by_index(self):
for idx in [1, 2, 3, 4]:
assert idx == self.repo.get_commit(commit_idx=idx).idx
project: added all source files and assets
r1 def test_get_commit_by_branch(self):
python3: removed usage of .iteritems()
r4932 for branch, commit_id in self.repo.branches.items():
project: added all source files and assets
r1 assert commit_id == self.repo.get_commit(branch).raw_id
def test_get_commit_by_tag(self):
python3: removed usage of .iteritems()
r4932 for tag, commit_id in self.repo.tags.items():
project: added all source files and assets
r1 assert commit_id == self.repo.get_commit(tag).raw_id
def test_get_commit_parents(self):
repo = self.repo
for test_idx in [1, 2, 3]:
commit = repo.get_commit(commit_idx=test_idx - 1)
assert [commit] == repo.get_commit(commit_idx=test_idx).parents
def test_get_commit_children(self):
repo = self.repo
for test_idx in [1, 2, 3]:
commit = repo.get_commit(commit_idx=test_idx + 1)
assert [commit] == repo.get_commit(commit_idx=test_idx).children
tests: use gunicorn for testing. This is close to production testing...
r2453 @pytest.mark.usefixtures("vcs_repository_support")
project: added all source files and assets
r1 class TestCommits(BackendTestMixin):
recreate_repo_per_test = False
@classmethod
def _get_commits(cls):
start_date = datetime.datetime(2010, 1, 1, 20)
python3: removed use of xrang
r4906 for x in range(5):
project: added all source files and assets
r1 yield {
tests: fixed test suite for celery adoption
r5607 "message": "Commit %d" % x,
"author": "Joe Doe <joe.doe@example.com>",
"date": start_date + datetime.timedelta(hours=12 * x),
"added": [FileNode(b"file_%d.txt" % x, content=b"Foobar %d" % x)],
project: added all source files and assets
r1 }
def test_simple(self):
tip = self.repo.get_commit()
assert tip.date, datetime.datetime(2010, 1, 3 == 20)
def test_simple_serialized_commit(self):
tip = self.repo.get_commit()
# json.dumps(tip) uses .__json__() method
data = tip.__json__()
tests: fixed test suite for celery adoption
r5607 assert "branch" in data
assert data["revision"]
project: added all source files and assets
r1
def test_retrieve_tip(self):
tests: fixed test suite for celery adoption
r5607 tip = self.repo.get_commit("tip")
project: added all source files and assets
r1 assert tip == self.repo.get_commit()
def test_invalid(self):
with pytest.raises(CommitDoesNotExistError):
self.repo.get_commit(commit_idx=123456789)
def test_idx(self):
commit = self.repo[0]
assert commit.idx == 0
def test_negative_idx(self):
commit = self.repo.get_commit(commit_idx=-1)
assert commit.idx >= 0
def test_revision_is_deprecated(self):
def get_revision(commit):
return commit.revision
commit = self.repo[0]
pytest.deprecated_call(get_revision, commit)
def test_size(self):
tip = self.repo.get_commit()
tests: fixed test suite for celery adoption
r5607 size = 5 * len("Foobar N") # Size of 5 files
project: added all source files and assets
r1 assert tip.size == size
def test_size_at_commit(self):
tip = self.repo.get_commit()
tests: fixed test suite for celery adoption
r5607 size = 5 * len("Foobar N") # Size of 5 files
project: added all source files and assets
r1 assert self.repo.size_at_commit(tip.raw_id) == size
def test_size_at_first_commit(self):
commit = self.repo[0]
tests: fixed test suite for celery adoption
r5607 size = len("Foobar N") # Size of 1 file
project: added all source files and assets
r1 assert self.repo.size_at_commit(commit.raw_id) == size
def test_author(self):
tip = self.repo.get_commit()
tests: fixed test suite for celery adoption
r5607 assert_text_equal(tip.author, "Joe Doe <joe.doe@example.com>")
project: added all source files and assets
r1
def test_author_name(self):
tip = self.repo.get_commit()
tests: fixed test suite for celery adoption
r5607 assert_text_equal(tip.author_name, "Joe Doe")
project: added all source files and assets
r1
def test_author_email(self):
tip = self.repo.get_commit()
tests: fixed test suite for celery adoption
r5607 assert_text_equal(tip.author_email, "joe.doe@example.com")
project: added all source files and assets
r1
def test_message(self):
tip = self.repo.get_commit()
tests: fixed test suite for celery adoption
r5607 assert_text_equal(tip.message, "Commit 4")
project: added all source files and assets
r1
def test_diff(self):
tip = self.repo.get_commit()
diff = tip.diff()
tests: fixed all tests for python3 BIG changes
r5087 assert b"+Foobar 4" in diff.raw.tobytes()
project: added all source files and assets
r1
def test_prev(self):
tip = self.repo.get_commit()
prev_commit = tip.prev()
tests: fixed test suite for celery adoption
r5607 assert prev_commit.message == "Commit 3"
project: added all source files and assets
r1
def test_prev_raises_on_first_commit(self):
commit = self.repo.get_commit(commit_idx=0)
with pytest.raises(CommitDoesNotExistError):
commit.prev()
def test_prev_works_on_second_commit_issue_183(self):
commit = self.repo.get_commit(commit_idx=1)
prev_commit = commit.prev()
assert prev_commit.idx == 0
def test_next(self):
commit = self.repo.get_commit(commit_idx=2)
next_commit = commit.next()
tests: fixed test suite for celery adoption
r5607 assert next_commit.message == "Commit 3"
project: added all source files and assets
r1
def test_next_raises_on_tip(self):
commit = self.repo.get_commit()
with pytest.raises(CommitDoesNotExistError):
commit.next()
vcs: rename get_file_history to get_path_history as it better reflects what it does.
r3275 def test_get_path_commit(self):
project: added all source files and assets
r1 commit = self.repo.get_commit()
tests: fixed test suite for celery adoption
r5607 commit.get_path_commit("file_4.txt")
assert commit.message == "Commit 4"
project: added all source files and assets
r1
def test_get_filenodes_generator(self):
tip = self.repo.get_commit()
filepaths = [node.path for node in tip.get_filenodes_generator()]
tests: fixed test suite for celery adoption
r5607 assert filepaths == ["file_%d.txt" % x for x in range(5)]
project: added all source files and assets
r1
def test_get_file_annotate(self):
file_added_commit = self.repo.get_commit(commit_idx=3)
tests: fixed test suite for celery adoption
r5607 annotations = list(file_added_commit.get_file_annotate("file_3.txt"))
tests: fixed tests after removing hardcoded timezone in tests.
r1351
project: added all source files and assets
r1 line_no, commit_id, commit_loader, line = annotations[0]
tests: fixed tests after removing hardcoded timezone in tests.
r1351
project: added all source files and assets
r1 assert line_no == 1
assert commit_id == file_added_commit.raw_id
assert commit_loader() == file_added_commit
tests: fixed test suite for celery adoption
r5607 assert b"Foobar 3" in line
project: added all source files and assets
r1
def test_get_file_annotate_does_not_exist(self):
file_added_commit = self.repo.get_commit(commit_idx=2)
# TODO: Should use a specific exception class here?
with pytest.raises(Exception):
tests: fixed test suite for celery adoption
r5607 list(file_added_commit.get_file_annotate("file_3.txt"))
project: added all source files and assets
r1
def test_get_file_annotate_tip(self):
tip = self.repo.get_commit()
commit = self.repo.get_commit(commit_idx=3)
tests: fixed test suite for celery adoption
r5607 expected_values = list(commit.get_file_annotate("file_3.txt"))
annotations = list(tip.get_file_annotate("file_3.txt"))
project: added all source files and assets
r1
# Note: Skip index 2 because the loader function is not the same
for idx in (0, 1, 3):
assert annotations[0][idx] == expected_values[0][idx]
def test_get_commits_is_ordered_by_date(self):
commits = self.repo.get_commits()
assert isinstance(commits, CollectionGenerator)
assert len(commits) == 0 or len(commits) != 0
commits = list(commits)
ordered_by_date = sorted(commits, key=lambda commit: commit.date)
assert commits == ordered_by_date
def test_get_commits_respects_start(self):
second_id = self.repo.commit_ids[1]
commits = self.repo.get_commits(start_id=second_id)
assert isinstance(commits, CollectionGenerator)
commits = list(commits)
assert len(commits) == 4
def test_get_commits_includes_start_commit(self):
second_id = self.repo.commit_ids[1]
commits = self.repo.get_commits(start_id=second_id)
assert isinstance(commits, CollectionGenerator)
commits = list(commits)
assert commits[0].raw_id == second_id
def test_get_commits_respects_end(self):
second_id = self.repo.commit_ids[1]
commits = self.repo.get_commits(end_id=second_id)
assert isinstance(commits, CollectionGenerator)
commits = list(commits)
assert commits[-1].raw_id == second_id
assert len(commits) == 2
def test_get_commits_respects_both_start_and_end(self):
second_id = self.repo.commit_ids[1]
third_id = self.repo.commit_ids[2]
commits = self.repo.get_commits(start_id=second_id, end_id=third_id)
assert isinstance(commits, CollectionGenerator)
commits = list(commits)
assert len(commits) == 2
def test_get_commits_on_empty_repo_raises_EmptyRepository_error(self):
repo_path = get_new_dir(str(time.time()))
repo = self.Backend(repo_path, create=True)
with pytest.raises(EmptyRepositoryError):
tests: fixed test suite for celery adoption
r5607 list(repo.get_commits(start_id="foobar"))
project: added all source files and assets
r1
commits: hide evolve commits. Fixes #5392
r2144 def test_get_commits_respects_hidden(self):
commits = self.repo.get_commits(show_hidden=True)
assert isinstance(commits, CollectionGenerator)
assert len(commits) == 5
project: added all source files and assets
r1 def test_get_commits_includes_end_commit(self):
second_id = self.repo.commit_ids[1]
commits = self.repo.get_commits(end_id=second_id)
assert isinstance(commits, CollectionGenerator)
assert len(commits) == 2
commits = list(commits)
assert commits[-1].raw_id == second_id
def test_get_commits_respects_start_date(self):
start_date = datetime.datetime(2010, 1, 2)
commits = self.repo.get_commits(start_date=start_date)
assert isinstance(commits, CollectionGenerator)
# Should be 4 commits after 2010-01-02 00:00:00
assert len(commits) == 4
for c in commits:
assert c.date >= start_date
commits: hide evolve commits. Fixes #5392
r2144 def test_get_commits_respects_start_date_with_branch(self):
start_date = datetime.datetime(2010, 1, 2)
tests: fixed test suite for celery adoption
r5607 commits = self.repo.get_commits(start_date=start_date, branch_name=self.repo.DEFAULT_BRANCH_NAME)
commits: hide evolve commits. Fixes #5392
r2144 assert isinstance(commits, CollectionGenerator)
# Should be 4 commits after 2010-01-02 00:00:00
assert len(commits) == 4
for c in commits:
assert c.date >= start_date
project: added all source files and assets
r1 def test_get_commits_respects_start_date_and_end_date(self):
start_date = datetime.datetime(2010, 1, 2)
end_date = datetime.datetime(2010, 1, 3)
tests: fixed test suite for celery adoption
r5607 commits = self.repo.get_commits(start_date=start_date, end_date=end_date)
project: added all source files and assets
r1 assert isinstance(commits, CollectionGenerator)
assert len(commits) == 2
for c in commits:
assert c.date >= start_date
assert c.date <= end_date
def test_get_commits_respects_end_date(self):
end_date = datetime.datetime(2010, 1, 2)
commits = self.repo.get_commits(end_date=end_date)
assert isinstance(commits, CollectionGenerator)
assert len(commits) == 1
for c in commits:
assert c.date <= end_date
def test_get_commits_respects_reverse(self):
commits = self.repo.get_commits() # no longer reverse support
assert isinstance(commits, CollectionGenerator)
assert len(commits) == 5
commit_ids = reversed([c.raw_id for c in commits])
assert list(commit_ids) == list(reversed(self.repo.commit_ids))
def test_get_commits_slice_generator(self):
tests: fixed test suite for celery adoption
r5607 commits = self.repo.get_commits(branch_name=self.repo.DEFAULT_BRANCH_NAME)
project: added all source files and assets
r1 assert isinstance(commits, CollectionGenerator)
commit_slice = list(commits[1:3])
assert len(commit_slice) == 2
def test_get_commits_raise_commitdoesnotexist_for_wrong_start(self):
with pytest.raises(CommitDoesNotExistError):
tests: fixed test suite for celery adoption
r5607 list(self.repo.get_commits(start_id="foobar"))
project: added all source files and assets
r1
def test_get_commits_raise_commitdoesnotexist_for_wrong_end(self):
with pytest.raises(CommitDoesNotExistError):
tests: fixed test suite for celery adoption
r5607 list(self.repo.get_commits(end_id="foobar"))
project: added all source files and assets
r1
def test_get_commits_raise_branchdoesnotexist_for_wrong_branch_name(self):
with pytest.raises(BranchDoesNotExistError):
tests: fixed test suite for celery adoption
r5607 list(self.repo.get_commits(branch_name="foobar"))
project: added all source files and assets
r1
def test_get_commits_raise_repositoryerror_for_wrong_start_end(self):
start_id = self.repo.commit_ids[-1]
end_id = self.repo.commit_ids[0]
with pytest.raises(RepositoryError):
list(self.repo.get_commits(start_id=start_id, end_id=end_id))
def test_get_commits_raises_for_numerical_ids(self):
with pytest.raises(TypeError):
self.repo.get_commits(start_id=1, end_id=2)
dan
vcs: add equality testing for commits against non commits to allow...
r985 def test_commit_equality(self):
commit1 = self.repo.get_commit(self.repo.commit_ids[0])
commit2 = self.repo.get_commit(self.repo.commit_ids[1])
assert commit1 == commit1
assert commit2 == commit2
assert commit1 != commit2
assert commit2 != commit1
tests: fixed all tests for python3 BIG changes
r5087 assert commit1 is not None
assert commit2 is not None
dan
vcs: add equality testing for commits against non commits to allow...
r985 assert 1 != commit1
tests: fixed test suite for celery adoption
r5607 assert "string" != commit1
dan
vcs: add equality testing for commits against non commits to allow...
r985
project: added all source files and assets
r1
tests: fixed test suite for celery adoption
r5607 @pytest.mark.parametrize(
"filename, expected",
[
("README.rst", False),
("README", True),
],
)
project: added all source files and assets
r1 def test_commit_is_link(vcsbackend, filename, expected):
commit = vcsbackend.repo.get_commit()
link_status = commit.is_link(filename)
assert link_status is expected
tests: use gunicorn for testing. This is close to production testing...
r2453 @pytest.mark.usefixtures("vcs_repository_support")
project: added all source files and assets
r1 class TestCommitsChanges(BackendTestMixin):
recreate_repo_per_test = False
@classmethod
def _get_commits(cls):
return [
{
tests: fixed test suite for celery adoption
r5607 "message": "Initial",
"author": "Joe Doe <joe.doe@example.com>",
"date": datetime.datetime(2010, 1, 1, 20),
"added": [
FileNode(b"foo/bar", content=b"foo"),
FileNode(safe_bytes("foo/bał"), content=b"foo"),
FileNode(b"foobar", content=b"foo"),
FileNode(b"qwe", content=b"foo"),
project: added all source files and assets
r1 ],
},
{
tests: fixed test suite for celery adoption
r5607 "message": "Massive changes",
"author": "Joe Doe <joe.doe@example.com>",
"date": datetime.datetime(2010, 1, 1, 22),
"added": [FileNode(b"fallout", content=b"War never changes")],
"changed": [
FileNode(b"foo/bar", content=b"baz"),
FileNode(b"foobar", content=b"baz"),
project: added all source files and assets
r1 ],
tests: fixed test suite for celery adoption
r5607 "removed": [FileNode(b"qwe")],
project: added all source files and assets
r1 },
]
tests: fixed tests after removing hardcoded timezone in tests.
r1351 def test_initial_commit(self, local_dt_to_utc):
project: added all source files and assets
r1 commit = self.repo.get_commit(commit_idx=0)
tests: fixed all tests for python3 BIG changes
r5087 assert set(commit.added) == {
tests: fixed test suite for celery adoption
r5607 commit.get_node("foo/bar"),
commit.get_node("foo/bał"),
commit.get_node("foobar"),
commit.get_node("qwe"),
tests: fixed all tests for python3 BIG changes
r5087 }
project: added all source files and assets
r1 assert set(commit.changed) == set()
assert set(commit.removed) == set()
tests: fixed test suite for celery adoption
r5607 assert set(commit.affected_files) == {"foo/bar", "foo/bał", "foobar", "qwe"}
assert commit.date == local_dt_to_utc(datetime.datetime(2010, 1, 1, 20, 0))
project: added all source files and assets
r1
def test_head_added(self):
commit = self.repo.get_commit()
assert isinstance(commit.added, AddedFileNodesGenerator)
tests: fixed test suite for celery adoption
r5607 assert set(commit.added) == {commit.get_node("fallout")}
project: added all source files and assets
r1 assert isinstance(commit.changed, ChangedFileNodesGenerator)
tests: fixed test suite for celery adoption
r5607 assert set(commit.changed) == {commit.get_node("foo/bar"), commit.get_node("foobar")}
project: added all source files and assets
r1 assert isinstance(commit.removed, RemovedFileNodesGenerator)
assert len(commit.removed) == 1
tests: fixed test suite for celery adoption
r5607 assert list(commit.removed)[0].path == "qwe"
project: added all source files and assets
r1
def test_get_filemode(self):
commit = self.repo.get_commit()
tests: fixed test suite for celery adoption
r5607 assert FILEMODE_DEFAULT == commit.get_file_mode("foo/bar")
project: added all source files and assets
r1
def test_get_filemode_non_ascii(self):
commit = self.repo.get_commit()
tests: fixed test suite for celery adoption
r5607 assert FILEMODE_DEFAULT == commit.get_file_mode("foo/bał")
assert FILEMODE_DEFAULT == commit.get_file_mode("foo/bał")
project: added all source files and assets
r1
vcs: rename get_file_history to get_path_history as it better reflects what it does.
r3275 def test_get_path_history(self):
project: added all source files and assets
r1 commit = self.repo.get_commit()
tests: fixed test suite for celery adoption
r5607 history = commit.get_path_history("foo/bar")
project: added all source files and assets
r1 assert len(history) == 2
vcs: rename get_file_history to get_path_history as it better reflects what it does.
r3275 def test_get_path_history_with_limit(self):
project: added all source files and assets
r1 commit = self.repo.get_commit()
tests: fixed test suite for celery adoption
r5607 history = commit.get_path_history("foo/bar", limit=1)
project: added all source files and assets
r1 assert len(history) == 1
vcs: rename get_file_history to get_path_history as it better reflects what it does.
r3275 def test_get_path_history_first_commit(self):
project: added all source files and assets
r1 commit = self.repo[0]
tests: fixed test suite for celery adoption
r5607 history = commit.get_path_history("foo/bar")
project: added all source files and assets
r1 assert len(history) == 1
def assert_text_equal(expected, given):
assert expected == given
python3: removed more unicode usage
r4952 assert isinstance(expected, str)
assert isinstance(given, str)