depot tools unit tests: custom git metadata doesn't work at all |
||
Issue description
There seems to be a feature in git_test_utils for specifying custom metadata (like author name, etc) in a Git commit for testing, like this:
COMMIT_C = {
'AUTHOR_NAME': 'Custom Author',
'AUTHOR_EMAIL': 'author@example.com',
'AUTHOR_DATE': datetime.datetime(1980, 9, 8, 7, 6, 5,
tzinfo=git_test_utils.UTC),
'COMMITTER_NAME': 'Custom Committer',
'COMMITTER_EMAIL': 'committer@example.com',
'COMMITTER_DATE': datetime.datetime(1990, 4, 5, 6, 7, 8,
tzinfo=git_test_utils.UTC),
'file1': {'data': 'file1 changed again'},
}
But it doesn't work at all. There's code to kind of handle this but it does something else (I don't understand what it's trying to do), and these special keys are still interpreted as files, so they don't work.
Nobody uses this feature. I need it for testing Issue 808905 so let's make it work...
,
Feb 12 2018
Sorry, I've already chatted with Robbie on https://crrev.com/c/chromium/tools/depot_tools/+/901122 It turns out I was holding it wrong... but it still doesn't quite work. The CL has been updated to fix the small issue. The issue is, you aren't supposed to use a string, but refer to the named variable inside GitRepo. Like this: GitRepo = git_test_utils.GitRepo COMMIT_C = { GitRepo.AUTHOR_NAME: 'Custom Author', GitRepo.AUTHOR_EMAIL: 'author@example.com', GitRepo.AUTHOR_DATE: datetime.datetime(1980, 9, 8, 7, 6, 5, tzinfo=git_test_utils.UTC), GitRepo.COMMITTER_NAME: 'Custom Committer', GitRepo.COMMITTER_EMAIL: 'committer@example.com', GitRepo.COMMITTER_DATE: datetime.datetime(1990, 4, 5, 6, 7, 8, tzinfo=git_test_utils.UTC), GitRepo.file1: {'data': 'file1 changed again'}, }
,
Feb 12 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/tools/depot_tools/+/705e51807fec5f379bc32ece0448d60b1cc8a110 commit 705e51807fec5f379bc32ece0448d60b1cc8a110 Author: Matt Giuca <mgiuca@chromium.org> Date: Mon Feb 12 07:12:57 2018 git_test_utils: Fixed custom git metadata in git commit schemas. Previously, if you used custom metadata keys in a test commit (like GitRepo.AUTHOR_NAME), they would also be treated as filenames, and fail because they aren't strings. (This wasn't a problem because it isn't currently used in any tests.) Bug: 808941 Change-Id: Id7c4fa5822741925beba591ea587bd8ebbf2e478 Reviewed-on: https://chromium-review.googlesource.com/901122 Reviewed-by: Robbie Iannucci <iannucci@chromium.org> Commit-Queue: Robbie Iannucci <iannucci@chromium.org> [modify] https://crrev.com/705e51807fec5f379bc32ece0448d60b1cc8a110/tests/git_common_test.py [modify] https://crrev.com/705e51807fec5f379bc32ece0448d60b1cc8a110/testing_support/git_test_utils.py
,
Feb 12 2018
|
||
►
Sign in to add a comment |
||
Comment 1 by aga...@chromium.org
, Feb 9 2018