diff --git a/trytond/trytond/backend/sqlite/database.py b/trytond/trytond/backend/sqlite/database.py index 2457af2867..f7f3705cb4 100644 --- a/trytond/trytond/backend/sqlite/database.py +++ b/trytond/trytond/backend/sqlite/database.py @@ -547,7 +547,8 @@ class Database(DatabaseInterface): db_path = safe_join( config.get('database', 'path'), self.name + '.sqlite') if not os.path.isfile(db_path): - raise IOError("Database '%s' doesn't exist!" % db_path) + raise DatabaseOperationalError( + f"Database '{db_path}' doesn't exist!") db_uri = base_uri._replace(path=db_path) # Use unparse before replacing sqlite with file because SQLite accepts diff --git a/trytond/trytond/tests/test_transaction.py b/trytond/trytond/tests/test_transaction.py index bada1d4ca4..ed9d445b9a 100644 --- a/trytond/trytond/tests/test_transaction.py +++ b/trytond/trytond/tests/test_transaction.py @@ -33,8 +33,8 @@ class TransactionTestCase(TestCase): and ensure that it stops cleanly and allows starting of next transaction''' self.assertRaises( - Exception, empty_transaction, "Non existant DB", USER, - context=CONTEXT) + backend.DatabaseOperationalError, empty_transaction, + "Non%20existant%20DB", USER, context=CONTEXT) self.assertTrue(empty_transaction(DB_NAME, USER, context=CONTEXT)) def test_set_user(self):