diff test/test_admin.py @ 7392:bd6523c84a95

Fix test failure caused by making genconfig trackerless When I removed the need to have a tracker for genconfig, I broke a couple of tests. The breakage was hidden by a bad workflow. This change allows the tests to pass and refactors reporting of UsageError exceptions in admin.py. It also adds a test for failure in install command as there is a test case for it and this test tests the refactor.
author John Rouillard <rouilj@ieee.org>
date Wed, 24 May 2023 11:25:47 -0400
parents af870e295b46
children 312d52305583
line wrap: on
line diff
--- a/test/test_admin.py	Wed May 24 10:48:01 2023 -0400
+++ b/test/test_admin.py	Wed May 24 11:25:47 2023 -0400
@@ -255,6 +255,18 @@
         self.assertTrue(os.path.isfile(self.dirname + "/config.ini"))
         self.assertTrue(os.path.isfile(self.dirname + "/schema.py"))
 
+        self.admin=AdminTool()
+        with captured_output() as (out, err):
+            sys.argv=['main', '-i', '/tmp/noSuchDirectory/nodir', 'install', 'classic', self.backend]
+            ret = self.admin.main()
+
+        out = out.getvalue().strip()
+        print(ret)
+        print(out)
+        self.assertEqual(ret, 1)
+        self.assertIn('Error: Instance home parent directory '
+                      '"/tmp/noSuchDirectory" does not exist', out)
+
     def testInitWithConfig_ini(self):
         from roundup.configuration import CoreConfig
         self.admin=AdminTool()

Roundup Issue Tracker: http://roundup-tracker.org/