aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unittests/report_tests.py
diff options
context:
space:
mode:
authorMartin Pitt <mpitt@debian.org>2024-01-10 07:59:37 +0100
committerJake Hunsaker <jacob.r.hunsaker@gmail.com>2024-01-10 19:51:26 -0500
commit769768aabcae3d0265332ee72e9df94d1001f14c (patch)
treea9dac456ad876fae21f1ba4ce5c580257b131e0c /tests/unittests/report_tests.py
parent68aef93482543e68bfe92966a853cf5c1d7ea12e (diff)
downloadsos-769768aabcae3d0265332ee72e9df94d1001f14c.tar.gz
[tests] Drop obsolete TestCase.assertEquals()
`unittest.TestCase.assertEquals()` was deprecated in Python 3 [1], and finally dropped in Python 3.12. This now causes the unit tests to fail [2]. [1] https://docs.python.org/3.5/library/unittest.html#deprecated-aliases [2] https://bugs.debian.org/1058214 Signed-off-by: Martin Pitt <mpitt@debian.org>
Diffstat (limited to 'tests/unittests/report_tests.py')
-rw-r--r--tests/unittests/report_tests.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/unittests/report_tests.py b/tests/unittests/report_tests.py
index bb059012..6e202cef 100644
--- a/tests/unittests/report_tests.py
+++ b/tests/unittests/report_tests.py
@@ -23,7 +23,7 @@ class ReportTest(unittest.TestCase):
expected = json.dumps({})
- self.assertEquals(expected, str(report))
+ self.assertEqual(expected, str(report))
def test_nested_section(self):
report = Report()
@@ -32,7 +32,7 @@ class ReportTest(unittest.TestCase):
expected = json.dumps({"section": {}})
- self.assertEquals(expected, str(report))
+ self.assertEqual(expected, str(report))
def test_multiple_sections(self):
report = Report()
@@ -45,7 +45,7 @@ class ReportTest(unittest.TestCase):
expected = json.dumps({"section": {},
"section2": {}, })
- self.assertEquals(expected, str(report))
+ self.assertEqual(expected, str(report))
def test_deeply_nested(self):
report = Report()
@@ -61,7 +61,7 @@ class ReportTest(unittest.TestCase):
"return_code": 0,
"href": "does/not/matter"}]}})
- self.assertEquals(expected, str(report))
+ self.assertEqual(expected, str(report))
class TestPlainReport(unittest.TestCase):
@@ -78,13 +78,13 @@ class TestPlainReport(unittest.TestCase):
])
def test_basic(self):
- self.assertEquals(self.pluglist.format(pluglist=""),
+ self.assertEqual(self.pluglist.format(pluglist=""),
PlainTextReport(self.report).unicode())
def test_one_section(self):
self.report.add(self.section)
- self.assertEquals(self.defaultheader,
+ self.assertEqual(self.defaultheader,
PlainTextReport(self.report).unicode() + '\n')
def test_two_sections(self):
@@ -92,7 +92,7 @@ class TestPlainReport(unittest.TestCase):
section2 = Section(name="second")
self.report.add(section1, section2)
- self.assertEquals(u''.join([
+ self.assertEqual(u''.join([
self.pluglist.format(pluglist=" first second"),
self.div,
"\nfirst",
@@ -108,7 +108,7 @@ class TestPlainReport(unittest.TestCase):
self.section.add(cmd)
self.report.add(self.section)
- self.assertEquals(u''.join([
+ self.assertEqual(u''.join([
self.defaultheader,
"- commands executed:\n * ls -al /foo/bar/baz"
]),
@@ -119,7 +119,7 @@ class TestPlainReport(unittest.TestCase):
self.section.add(cf)
self.report.add(self.section)
- self.assertEquals(u''.join([
+ self.assertEqual(u''.join([
self.defaultheader,
"- files copied:\n * /etc/hosts"
]),
@@ -131,7 +131,7 @@ class TestPlainReport(unittest.TestCase):
self.section.add(crf)
self.report.add(self.section)
- self.assertEquals(u''.join([
+ self.assertEqual(u''.join([
self.defaultheader,
"- files created:\n * sample.txt"
]),
@@ -142,7 +142,7 @@ class TestPlainReport(unittest.TestCase):
self.section.add(alrt)
self.report.add(self.section)
- self.assertEquals(u''.join([
+ self.assertEqual(u''.join([
self.defaultheader,
"- alerts:\n ! this is an alert"
]),