Skip to content

Commit

Permalink
tests: assertEquals -> assertEqual
Browse files Browse the repository at this point in the history
The former is removed in Python 3.13

QubesOS/qubes-issues#9402
  • Loading branch information
marmarek committed Aug 21, 2024
1 parent 7f7e1b6 commit 256c991
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions qubespdfconverter/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def create_pdf(self, filename, content):
def get_pdfinfo(self, filename):
p = self.vm.run('pdfinfo "{}"'.format(filename), passio_popen=True)
(stdout, _) = p.communicate()
self.assertEquals(p.returncode, 0,
self.assertEqual(p.returncode, 0,
"Failed to get pdfinfo of {}".format(filename))
pdfinfo = {}
for line in stdout.decode().splitlines():
Expand All @@ -84,7 +84,7 @@ def get_pdfinfo(self, filename):
return pdfinfo

def assertCorrectlyTransformed(self, orig_filename, trusted_filename):
self.assertEquals(
self.assertEqual(
self.vm.run('test -r "{}"'.format(trusted_filename), wait=True), 0)
# TODO: somehow verify content of generated file, for now perform
# some heuristics
Expand All @@ -95,33 +95,33 @@ def assertCorrectlyTransformed(self, orig_filename, trusted_filename):

untrusted_backup = 'QubesUntrustedPDFs/{}'.format(os.path.basename(
trusted_filename.replace('.trusted', '')))
self.assertEquals(
self.assertEqual(
self.vm.run('test -r "{}"'.format(untrusted_backup), wait=True), 0)
self.assertEquals(self.vm.run(
self.assertEqual(self.vm.run(
'diff "{}" "{}"'.format(orig_filename, untrusted_backup), wait=True), 0)

def test_000_one_page(self):
self.create_pdf('test.pdf', ['This is test'])
p = self.vm.run('cp test.pdf orig.pdf; qvm-convert-pdf test.pdf 2>&1',
passio_popen=True)
(stdout, _) = p.communicate()
self.assertEquals(p.returncode, 0, 'qvm-convert-pdf failed: {}'.format(stdout))
self.assertEqual(p.returncode, 0, 'qvm-convert-pdf failed: {}'.format(stdout))
self.assertCorrectlyTransformed('orig.pdf', 'test.trusted.pdf')

def test_001_two_pages(self):
self.create_pdf('test.pdf', ['This is test', 'Second page'])
p = self.vm.run('cp test.pdf orig.pdf; qvm-convert-pdf test.pdf 2>&1',
passio_popen=True)
(stdout, _) = p.communicate()
self.assertEquals(p.returncode, 0, 'qvm-convert-pdf failed: {}'.format(stdout))
self.assertEqual(p.returncode, 0, 'qvm-convert-pdf failed: {}'.format(stdout))
self.assertCorrectlyTransformed('orig.pdf', 'test.trusted.pdf')

def test_002_500_pages(self):
self.create_pdf('test.pdf', ['This is test'] * 500)
p = self.vm.run('cp test.pdf orig.pdf; qvm-convert-pdf test.pdf 2>&1',
passio_popen=True)
(stdout, _) = p.communicate()
self.assertEquals(p.returncode, 0, 'qvm-convert-pdf failed: {}'.format(stdout))
self.assertEqual(p.returncode, 0, 'qvm-convert-pdf failed: {}'.format(stdout))
self.assertCorrectlyTransformed('orig.pdf', 'test.trusted.pdf')

def test_003_filename_with_spaces(self):
Expand All @@ -131,7 +131,7 @@ def test_003_filename_with_spaces(self):
'qvm-convert-pdf "test with spaces.pdf" 2>&1',
passio_popen=True)
(stdout, _) = p.communicate()
self.assertEquals(p.returncode, 0, 'qvm-convert-pdf failed: {}'.format(stdout))
self.assertEqual(p.returncode, 0, 'qvm-convert-pdf failed: {}'.format(stdout))
self.assertCorrectlyTransformed('orig.pdf',
'test with spaces.trusted.pdf')

Expand Down

0 comments on commit 256c991

Please sign in to comment.