Fix argument order for assertEqual to (expected, observed)
assertEqual expects that the arguments provided to it should be (expected, observed). If a particluar order is kept as a convention, then it helps to provide a cleaner message to the developer if Unit Tests fail. The following patch fixes this issue. TrivialFix Closes-Bug: #1259292 Change-Id: I03c414a763b2d51210aaec362405912f29850e36
This commit is contained in:
parent
847065e9d1
commit
3438c2b8ad
|
@ -55,7 +55,7 @@ class TestCommands(base.BaseTestCase):
|
|||
self.addDetail('stdout', content.text_content(stdout))
|
||||
self.addDetail('stderr', content.text_content(stderr))
|
||||
self.assertIn('Running custom build_py command.', stdout)
|
||||
self.assertEqual(return_code, 0)
|
||||
self.assertEqual(0, return_code)
|
||||
|
||||
def test_custom_rpm_version_py_command(self):
|
||||
"""Test custom rpm_version command."""
|
||||
|
@ -63,12 +63,12 @@ class TestCommands(base.BaseTestCase):
|
|||
self.addDetail('stdout', content.text_content(stdout))
|
||||
self.addDetail('stderr', content.text_content(stderr))
|
||||
self.assertIn('Extracting rpm version', stdout)
|
||||
self.assertEqual(return_code, 0)
|
||||
self.assertEqual(0, return_code)
|
||||
|
||||
def test_freeze_command(self):
|
||||
"""Test that freeze output is sorted in a case-insensitive manner."""
|
||||
stdout, stderr, return_code = self.run_pbr('freeze')
|
||||
self.assertEqual(return_code, 0)
|
||||
self.assertEqual(0, return_code)
|
||||
pkgs = []
|
||||
for l in stdout.split('\n'):
|
||||
pkgs.append(l.split('==')[0].lower())
|
||||
|
|
|
@ -78,7 +78,7 @@ class TestCore(base.BaseTestCase):
|
|||
|
||||
def test_setup_py_build_sphinx(self):
|
||||
stdout, _, return_code = self.run_setup('build_sphinx')
|
||||
self.assertEqual(return_code, 0)
|
||||
self.assertEqual(0, return_code)
|
||||
|
||||
def test_sdist_extra_files(self):
|
||||
"""Test that the extra files are correctly added."""
|
||||
|
|
|
@ -315,13 +315,13 @@ class TestPackagingInGitRepoWithoutCommit(base.BaseTestCase):
|
|||
# No commits, no authors in list
|
||||
with open(os.path.join(self.package_dir, 'AUTHORS'), 'r') as f:
|
||||
body = f.read()
|
||||
self.assertEqual(body, '\n')
|
||||
self.assertEqual('\n', body)
|
||||
|
||||
def test_changelog(self):
|
||||
# No commits, nothing should be in the ChangeLog list
|
||||
with open(os.path.join(self.package_dir, 'ChangeLog'), 'r') as f:
|
||||
body = f.read()
|
||||
self.assertEqual(body, 'CHANGES\n=======\n\n')
|
||||
self.assertEqual('CHANGES\n=======\n\n', body)
|
||||
|
||||
|
||||
class TestPackagingWheels(base.BaseTestCase):
|
||||
|
@ -463,7 +463,7 @@ class TestNestedRequirements(base.BaseTestCase):
|
|||
with open(nested, 'w') as f:
|
||||
f.write('pbr')
|
||||
result = packaging.parse_requirements([requirements])
|
||||
self.assertEqual(result, ['pbr'])
|
||||
self.assertEqual(['pbr'], result)
|
||||
|
||||
|
||||
class TestVersions(base.BaseTestCase):
|
||||
|
|
Loading…
Reference in New Issue