mirror of
https://xff.cz/git/u-boot/
synced 2025-09-26 04:51:17 +02:00
patman: Convert camel case in func_test.py
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -114,7 +114,7 @@ class TestFunctional(unittest.TestCase):
|
|||||||
|
|
||||||
return cover_fname, fname_list
|
return cover_fname, fname_list
|
||||||
|
|
||||||
def testBasic(self):
|
def test_basic(self):
|
||||||
"""Tests the basic flow of patman
|
"""Tests the basic flow of patman
|
||||||
|
|
||||||
This creates a series from some hard-coded patches build from a simple
|
This creates a series from some hard-coded patches build from a simple
|
||||||
@@ -455,7 +455,7 @@ complicated as possible''')
|
|||||||
repo.branches.local.create('base', base_target)
|
repo.branches.local.create('base', base_target)
|
||||||
return repo
|
return repo
|
||||||
|
|
||||||
def testBranch(self):
|
def test_branch(self):
|
||||||
"""Test creating patches from a branch"""
|
"""Test creating patches from a branch"""
|
||||||
repo = self.make_git_tree()
|
repo = self.make_git_tree()
|
||||||
target = repo.lookup_reference('refs/heads/first')
|
target = repo.lookup_reference('refs/heads/first')
|
||||||
@@ -494,7 +494,7 @@ complicated as possible''')
|
|||||||
finally:
|
finally:
|
||||||
os.chdir(orig_dir)
|
os.chdir(orig_dir)
|
||||||
|
|
||||||
def testTags(self):
|
def test_tags(self):
|
||||||
"""Test collection of tags in a patchstream"""
|
"""Test collection of tags in a patchstream"""
|
||||||
text = '''This is a patch
|
text = '''This is a patch
|
||||||
|
|
||||||
@@ -508,7 +508,7 @@ Tested-by: %s
|
|||||||
'Reviewed-by': {self.joe, self.mary},
|
'Reviewed-by': {self.joe, self.mary},
|
||||||
'Tested-by': {self.leb}})
|
'Tested-by': {self.leb}})
|
||||||
|
|
||||||
def testInvalidTag(self):
|
def test_invalid_tag(self):
|
||||||
"""Test invalid tag in a patchstream"""
|
"""Test invalid tag in a patchstream"""
|
||||||
text = '''This is a patch
|
text = '''This is a patch
|
||||||
|
|
||||||
@@ -519,7 +519,7 @@ Serie-version: 2
|
|||||||
self.assertEqual("Line 3: Invalid tag = 'Serie-version: 2'",
|
self.assertEqual("Line 3: Invalid tag = 'Serie-version: 2'",
|
||||||
str(exc.exception))
|
str(exc.exception))
|
||||||
|
|
||||||
def testMissingEnd(self):
|
def test_missing_end(self):
|
||||||
"""Test a missing END tag"""
|
"""Test a missing END tag"""
|
||||||
text = '''This is a patch
|
text = '''This is a patch
|
||||||
|
|
||||||
@@ -532,7 +532,7 @@ Signed-off-by: Fred
|
|||||||
self.assertEqual(["Missing 'END' in section 'cover'"],
|
self.assertEqual(["Missing 'END' in section 'cover'"],
|
||||||
pstrm.commit.warn)
|
pstrm.commit.warn)
|
||||||
|
|
||||||
def testMissingBlankLine(self):
|
def test_missing_blank_line(self):
|
||||||
"""Test a missing blank line after a tag"""
|
"""Test a missing blank line after a tag"""
|
||||||
text = '''This is a patch
|
text = '''This is a patch
|
||||||
|
|
||||||
@@ -545,7 +545,7 @@ Signed-off-by: Fred
|
|||||||
self.assertEqual(["Missing 'blank line' in section 'Series-changes'"],
|
self.assertEqual(["Missing 'blank line' in section 'Series-changes'"],
|
||||||
pstrm.commit.warn)
|
pstrm.commit.warn)
|
||||||
|
|
||||||
def testInvalidCommitTag(self):
|
def test_invalid_commit_tag(self):
|
||||||
"""Test an invalid Commit-xxx tag"""
|
"""Test an invalid Commit-xxx tag"""
|
||||||
text = '''This is a patch
|
text = '''This is a patch
|
||||||
|
|
||||||
@@ -554,7 +554,7 @@ Commit-fred: testing
|
|||||||
pstrm = PatchStream.process_text(text)
|
pstrm = PatchStream.process_text(text)
|
||||||
self.assertEqual(["Line 3: Ignoring Commit-fred"], pstrm.commit.warn)
|
self.assertEqual(["Line 3: Ignoring Commit-fred"], pstrm.commit.warn)
|
||||||
|
|
||||||
def testSelfTest(self):
|
def test_self_test(self):
|
||||||
"""Test a tested by tag by this user"""
|
"""Test a tested by tag by this user"""
|
||||||
test_line = 'Tested-by: %s@napier.com' % os.getenv('USER')
|
test_line = 'Tested-by: %s@napier.com' % os.getenv('USER')
|
||||||
text = '''This is a patch
|
text = '''This is a patch
|
||||||
@@ -564,7 +564,7 @@ Commit-fred: testing
|
|||||||
pstrm = PatchStream.process_text(text)
|
pstrm = PatchStream.process_text(text)
|
||||||
self.assertEqual(["Ignoring '%s'" % test_line], pstrm.commit.warn)
|
self.assertEqual(["Ignoring '%s'" % test_line], pstrm.commit.warn)
|
||||||
|
|
||||||
def testSpaceBeforeTab(self):
|
def test_space_before_tab(self):
|
||||||
"""Test a space before a tab"""
|
"""Test a space before a tab"""
|
||||||
text = '''This is a patch
|
text = '''This is a patch
|
||||||
|
|
||||||
@@ -573,7 +573,7 @@ Commit-fred: testing
|
|||||||
pstrm = PatchStream.process_text(text)
|
pstrm = PatchStream.process_text(text)
|
||||||
self.assertEqual(["Line 3/0 has space before tab"], pstrm.commit.warn)
|
self.assertEqual(["Line 3/0 has space before tab"], pstrm.commit.warn)
|
||||||
|
|
||||||
def testLinesAfterTest(self):
|
def test_lines_after_test(self):
|
||||||
"""Test detecting lines after TEST= line"""
|
"""Test detecting lines after TEST= line"""
|
||||||
text = '''This is a patch
|
text = '''This is a patch
|
||||||
|
|
||||||
@@ -584,7 +584,7 @@ here
|
|||||||
pstrm = PatchStream.process_text(text)
|
pstrm = PatchStream.process_text(text)
|
||||||
self.assertEqual(["Found 2 lines after TEST="], pstrm.commit.warn)
|
self.assertEqual(["Found 2 lines after TEST="], pstrm.commit.warn)
|
||||||
|
|
||||||
def testBlankLineAtEnd(self):
|
def test_blank_line_at_end(self):
|
||||||
"""Test detecting a blank line at the end of a file"""
|
"""Test detecting a blank line at the end of a file"""
|
||||||
text = '''This is a patch
|
text = '''This is a patch
|
||||||
|
|
||||||
@@ -611,7 +611,7 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
|
|||||||
["Found possible blank line(s) at end of file 'lib/fdtdec.c'"],
|
["Found possible blank line(s) at end of file 'lib/fdtdec.c'"],
|
||||||
pstrm.commit.warn)
|
pstrm.commit.warn)
|
||||||
|
|
||||||
def testNoUpstream(self):
|
def test_no_upstream(self):
|
||||||
"""Test CountCommitsToBranch when there is no upstream"""
|
"""Test CountCommitsToBranch when there is no upstream"""
|
||||||
repo = self.make_git_tree()
|
repo = self.make_git_tree()
|
||||||
target = repo.lookup_reference('refs/heads/base')
|
target = repo.lookup_reference('refs/heads/base')
|
||||||
@@ -648,7 +648,7 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
|
|||||||
{'id': '1', 'name': 'Some patch'}]}
|
{'id': '1', 'name': 'Some patch'}]}
|
||||||
raise ValueError('Fake Patchwork does not understand: %s' % subpath)
|
raise ValueError('Fake Patchwork does not understand: %s' % subpath)
|
||||||
|
|
||||||
def testStatusMismatch(self):
|
def test_status_mismatch(self):
|
||||||
"""Test Patchwork patches not matching the series"""
|
"""Test Patchwork patches not matching the series"""
|
||||||
series = Series()
|
series = Series()
|
||||||
|
|
||||||
@@ -657,7 +657,7 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
|
|||||||
self.assertIn('Warning: Patchwork reports 1 patches, series has 0',
|
self.assertIn('Warning: Patchwork reports 1 patches, series has 0',
|
||||||
err.getvalue())
|
err.getvalue())
|
||||||
|
|
||||||
def testStatusReadPatch(self):
|
def test_status_read_patch(self):
|
||||||
"""Test handling a single patch in Patchwork"""
|
"""Test handling a single patch in Patchwork"""
|
||||||
series = Series()
|
series = Series()
|
||||||
series.commits = [Commit('abcd')]
|
series.commits = [Commit('abcd')]
|
||||||
@@ -669,7 +669,7 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
|
|||||||
self.assertEqual('1', patch.id)
|
self.assertEqual('1', patch.id)
|
||||||
self.assertEqual('Some patch', patch.raw_subject)
|
self.assertEqual('Some patch', patch.raw_subject)
|
||||||
|
|
||||||
def testParseSubject(self):
|
def test_parse_subject(self):
|
||||||
"""Test parsing of the patch subject"""
|
"""Test parsing of the patch subject"""
|
||||||
patch = status.Patch('1')
|
patch = status.Patch('1')
|
||||||
|
|
||||||
@@ -731,7 +731,7 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
|
|||||||
self.assertEqual('RESEND', patch.prefix)
|
self.assertEqual('RESEND', patch.prefix)
|
||||||
self.assertEqual(None, patch.version)
|
self.assertEqual(None, patch.version)
|
||||||
|
|
||||||
def testCompareSeries(self):
|
def test_compare_series(self):
|
||||||
"""Test operation of compare_with_series()"""
|
"""Test operation of compare_with_series()"""
|
||||||
commit1 = Commit('abcd')
|
commit1 = Commit('abcd')
|
||||||
commit1.subject = 'Subject 1'
|
commit1.subject = 'Subject 1'
|
||||||
@@ -833,7 +833,7 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
|
|||||||
return patch.comments
|
return patch.comments
|
||||||
raise ValueError('Fake Patchwork does not understand: %s' % subpath)
|
raise ValueError('Fake Patchwork does not understand: %s' % subpath)
|
||||||
|
|
||||||
def testFindNewResponses(self):
|
def test_find_new_responses(self):
|
||||||
"""Test operation of find_new_responses()"""
|
"""Test operation of find_new_responses()"""
|
||||||
commit1 = Commit('abcd')
|
commit1 = Commit('abcd')
|
||||||
commit1.subject = 'Subject 1'
|
commit1.subject = 'Subject 1'
|
||||||
@@ -971,7 +971,7 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
|
|||||||
return patch.comments
|
return patch.comments
|
||||||
raise ValueError('Fake Patchwork does not understand: %s' % subpath)
|
raise ValueError('Fake Patchwork does not understand: %s' % subpath)
|
||||||
|
|
||||||
def testCreateBranch(self):
|
def test_create_branch(self):
|
||||||
"""Test operation of create_branch()"""
|
"""Test operation of create_branch()"""
|
||||||
repo = self.make_git_tree()
|
repo = self.make_git_tree()
|
||||||
branch = 'first'
|
branch = 'first'
|
||||||
@@ -1058,7 +1058,7 @@ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
|
|||||||
self.assertEqual('Reviewed-by: %s' % self.mary, next(lines))
|
self.assertEqual('Reviewed-by: %s' % self.mary, next(lines))
|
||||||
self.assertEqual('Tested-by: %s' % self.leb, next(lines))
|
self.assertEqual('Tested-by: %s' % self.leb, next(lines))
|
||||||
|
|
||||||
def testParseSnippets(self):
|
def test_parse_snippets(self):
|
||||||
"""Test parsing of review snippets"""
|
"""Test parsing of review snippets"""
|
||||||
text = '''Hi Fred,
|
text = '''Hi Fred,
|
||||||
|
|
||||||
@@ -1088,7 +1088,7 @@ Even more
|
|||||||
|
|
||||||
And another comment
|
And another comment
|
||||||
|
|
||||||
> @@ -153,8 +143,13 @@ def CheckPatch(fname, show_types=False):
|
> @@ -153,8 +143,13 @@ def check_patch(fname, show_types=False):
|
||||||
> further down on the file
|
> further down on the file
|
||||||
> and more code
|
> and more code
|
||||||
> +Addition here
|
> +Addition here
|
||||||
@@ -1131,7 +1131,7 @@ line8
|
|||||||
'> Code line 7', '> Code line 8', '> Code line 9',
|
'> Code line 7', '> Code line 8', '> Code line 9',
|
||||||
'And another comment'],
|
'And another comment'],
|
||||||
['> File: file.c',
|
['> File: file.c',
|
||||||
'> Line: 153 / 143: def CheckPatch(fname, show_types=False):',
|
'> Line: 153 / 143: def check_patch(fname, show_types=False):',
|
||||||
'> and more code', '> +Addition here', '> +Another addition here',
|
'> and more code', '> +Addition here', '> +Another addition here',
|
||||||
'> codey', '> more codey', 'and another thing in same file'],
|
'> codey', '> more codey', 'and another thing in same file'],
|
||||||
['> File: file.c', '> Line: 253 / 243',
|
['> File: file.c', '> Line: 253 / 243',
|
||||||
@@ -1141,7 +1141,7 @@ line8
|
|||||||
'line2', 'line3', 'line4', 'line5', 'line6', 'line7', 'line8']],
|
'line2', 'line3', 'line4', 'line5', 'line6', 'line7', 'line8']],
|
||||||
pstrm.snippets)
|
pstrm.snippets)
|
||||||
|
|
||||||
def testReviewSnippets(self):
|
def test_review_snippets(self):
|
||||||
"""Test showing of review snippets"""
|
"""Test showing of review snippets"""
|
||||||
def _to_submitter(who):
|
def _to_submitter(who):
|
||||||
m_who = re.match('(.*) <(.*)>', who)
|
m_who = re.match('(.*) <(.*)>', who)
|
||||||
@@ -1196,7 +1196,7 @@ On some date Fred wrote:
|
|||||||
> + def __str__(self):
|
> + def __str__(self):
|
||||||
> + return self.subject
|
> + return self.subject
|
||||||
> +
|
> +
|
||||||
> def AddChange(self, version, info):
|
> def add_change(self, version, info):
|
||||||
> """Add a new change line to the change list for a version.
|
> """Add a new change line to the change list for a version.
|
||||||
>
|
>
|
||||||
A comment
|
A comment
|
||||||
@@ -1280,7 +1280,7 @@ Reviewed-by: %s
|
|||||||
self.assertEqual(terminal.PrintLine(
|
self.assertEqual(terminal.PrintLine(
|
||||||
' > +', col.MAGENTA), next(lines))
|
' > +', col.MAGENTA), next(lines))
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
terminal.PrintLine(' > def AddChange(self, version, info):',
|
terminal.PrintLine(' > def add_change(self, version, info):',
|
||||||
col.MAGENTA),
|
col.MAGENTA),
|
||||||
next(lines))
|
next(lines))
|
||||||
self.assertEqual(terminal.PrintLine(
|
self.assertEqual(terminal.PrintLine(
|
||||||
@@ -1296,7 +1296,7 @@ Reviewed-by: %s
|
|||||||
'4 new responses available in patchwork (use -d to write them to a new branch)',
|
'4 new responses available in patchwork (use -d to write them to a new branch)',
|
||||||
None), next(lines))
|
None), next(lines))
|
||||||
|
|
||||||
def testInsertTags(self):
|
def test_insert_tags(self):
|
||||||
"""Test inserting of review tags"""
|
"""Test inserting of review tags"""
|
||||||
msg = '''first line
|
msg = '''first line
|
||||||
second line.'''
|
second line.'''
|
||||||
|
Reference in New Issue
Block a user