Skip to content

Commit

Permalink
Fix failing directives tests
Browse files Browse the repository at this point in the history
  • Loading branch information
norbusan committed Feb 5, 2025
1 parent 6397d1e commit d4ad757
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tex2pdf-tools/tests/directives/test_directives.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ def test_v1_exists(self, mock_listdir):
mock_listdir.return_value = ['00readme.yaml', '00readme.json', 'otherfile.txt']
manager = DirectiveManager("dummy_dir")
with self.assertRaises(ValueError) as context:
manager.get_active_directives_file()
manager.v2_exists()
self.assertEqual(str(context.exception), 'More than one v2 00readme '
'directives file is not allowed.')
self.assertEqual(str(context.exception), 'Only one v2 00readme directives file is allowed.')


@patch('tex2pdf_tools.directives.os.listdir')
Expand Down Expand Up @@ -196,14 +196,15 @@ def test_add_files_exists(self, mock_listdir):
mock_listdir.return_value = ['00readme.json', '00readme.yaml',
'00README.XXX']
manager = DirectiveManager("dummy_dir")
error_str = 'More than one v2 00readme directives file is not allowed.'
error_str = 'Only one v2 00readme directives file is allowed.'
#self.assertFalse(manager.can_make_active('00README.XXX'), 'No longer option for active')
with self.assertRaises(ValueError) as context:
manager.can_make_active('00README.XXX')
self.assertEqual(str(context.exception), error_str)
self.assertTrue(manager.v1_exists())
self.assertTrue(manager.is_v1_file('00README.XXX'))
with self.assertRaises(ValueError) as context:
manager.get_active_directives_file()
manager.v2_exists()
self.assertEqual(str(context.exception), error_str)
self.assertFalse(manager.is_v2_file('00README.XXX'))
Expand All @@ -216,9 +217,11 @@ def test_add_files_exists(self, mock_listdir):
self.assertTrue(manager.v1_exists())
self.assertFalse(manager.is_v1_file('00readme.yaml'))
with self.assertRaises(ValueError) as context:
manager.get_active_directives_file()
manager.v2_exists()
self.assertTrue(manager.is_v2_file('00readme.yaml'))
with self.assertRaises(ValueError) as context:
manager.get_active_directives_file()
manager.is_active_directives_file('00readme.yaml')


Expand Down

0 comments on commit d4ad757

Please sign in to comment.