return cover_fname, fname_list
- def testBasic(self):
+ def test_basic(self):
"""Tests the basic flow of patman
This creates a series from some hard-coded patches build from a simple
repo.branches.local.create('base', base_target)
return repo
- def testBranch(self):
+ def test_branch(self):
"""Test creating patches from a branch"""
repo = self.make_git_tree()
target = repo.lookup_reference('refs/heads/first')
finally:
os.chdir(orig_dir)
- def testTags(self):
+ def test_tags(self):
"""Test collection of tags in a patchstream"""
text = '''This is a patch
'Reviewed-by': {self.joe, self.mary},
'Tested-by': {self.leb}})
- def testInvalidTag(self):
+ def test_invalid_tag(self):
"""Test invalid tag in a patchstream"""
text = '''This is a patch
self.assertEqual("Line 3: Invalid tag = 'Serie-version: 2'",
str(exc.exception))
- def testMissingEnd(self):
+ def test_missing_end(self):
"""Test a missing END tag"""
text = '''This is a patch
self.assertEqual(["Missing 'END' in section 'cover'"],
pstrm.commit.warn)
- def testMissingBlankLine(self):
+ def test_missing_blank_line(self):
"""Test a missing blank line after a tag"""
text = '''This is a patch
self.assertEqual(["Missing 'blank line' in section 'Series-changes'"],
pstrm.commit.warn)
- def testInvalidCommitTag(self):
+ def test_invalid_commit_tag(self):
"""Test an invalid Commit-xxx tag"""
text = '''This is a patch
pstrm = PatchStream.process_text(text)
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_line = 'Tested-by: %s@napier.com' % os.getenv('USER')
text = '''This is a patch
pstrm = PatchStream.process_text(text)
self.assertEqual(["Ignoring '%s'" % test_line], pstrm.commit.warn)
- def testSpaceBeforeTab(self):
+ def test_space_before_tab(self):
"""Test a space before a tab"""
text = '''This is a patch
pstrm = PatchStream.process_text(text)
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"""
text = '''This is a patch
pstrm = PatchStream.process_text(text)
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"""
text = '''This is a patch
["Found possible blank line(s) at end of file 'lib/fdtdec.c'"],
pstrm.commit.warn)
- def testNoUpstream(self):
+ def test_no_upstream(self):
"""Test CountCommitsToBranch when there is no upstream"""
repo = self.make_git_tree()
target = repo.lookup_reference('refs/heads/base')
{'id': '1', 'name': 'Some patch'}]}
raise ValueError('Fake Patchwork does not understand: %s' % subpath)
- def testStatusMismatch(self):
+ def test_status_mismatch(self):
"""Test Patchwork patches not matching the series"""
series = Series()
self.assertIn('Warning: Patchwork reports 1 patches, series has 0',
err.getvalue())
- def testStatusReadPatch(self):
+ def test_status_read_patch(self):
"""Test handling a single patch in Patchwork"""
series = Series()
series.commits = [Commit('abcd')]
self.assertEqual('1', patch.id)
self.assertEqual('Some patch', patch.raw_subject)
- def testParseSubject(self):
+ def test_parse_subject(self):
"""Test parsing of the patch subject"""
patch = status.Patch('1')
self.assertEqual('RESEND', patch.prefix)
self.assertEqual(None, patch.version)
- def testCompareSeries(self):
+ def test_compare_series(self):
"""Test operation of compare_with_series()"""
commit1 = Commit('abcd')
commit1.subject = 'Subject 1'
return patch.comments
raise ValueError('Fake Patchwork does not understand: %s' % subpath)
- def testFindNewResponses(self):
+ def test_find_new_responses(self):
"""Test operation of find_new_responses()"""
commit1 = Commit('abcd')
commit1.subject = 'Subject 1'
return patch.comments
raise ValueError('Fake Patchwork does not understand: %s' % subpath)
- def testCreateBranch(self):
+ def test_create_branch(self):
"""Test operation of create_branch()"""
repo = self.make_git_tree()
branch = 'first'
self.assertEqual('Reviewed-by: %s' % self.mary, next(lines))
self.assertEqual('Tested-by: %s' % self.leb, next(lines))
- def testParseSnippets(self):
+ def test_parse_snippets(self):
"""Test parsing of review snippets"""
text = '''Hi Fred,
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
> and more code
> +Addition here
'> Code line 7', '> Code line 8', '> Code line 9',
'And another comment'],
['> 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',
'> codey', '> more codey', 'and another thing in same file'],
['> File: file.c', '> Line: 253 / 243',
'line2', 'line3', 'line4', 'line5', 'line6', 'line7', 'line8']],
pstrm.snippets)
- def testReviewSnippets(self):
+ def test_review_snippets(self):
"""Test showing of review snippets"""
def _to_submitter(who):
m_who = re.match('(.*) <(.*)>', who)
> + def __str__(self):
> + 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.
>
A comment
self.assertEqual(terminal.PrintLine(
' > +', col.MAGENTA), next(lines))
self.assertEqual(
- terminal.PrintLine(' > def AddChange(self, version, info):',
+ terminal.PrintLine(' > def add_change(self, version, info):',
col.MAGENTA),
next(lines))
self.assertEqual(terminal.PrintLine(
'4 new responses available in patchwork (use -d to write them to a new branch)',
None), next(lines))
- def testInsertTags(self):
+ def test_insert_tags(self):
"""Test inserting of review tags"""
msg = '''first line
second line.'''