Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Jan 14, 2025
1 parent a1839b4 commit d1ab95b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
8 changes: 5 additions & 3 deletions click_odoo_contrib/backupdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,11 @@ def main(env, dbname, dest, force, if_exists, format, filestore):
filestore = False
db = odoo.sql_db.db_connect(dbname)
try:
with backup(
format, dest, "w"
) as _backup, db.cursor() as cr, db_management_enabled():
with (
backup(format, dest, "w") as _backup,
db.cursor() as cr,
db_management_enabled(),
):
if format != "dump":
_create_manifest(cr, dbname, _backup)
if filestore:
Expand Down
2 changes: 1 addition & 1 deletion click_odoo_contrib/initdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def main(
odoo_createdb(new_database, demo, module_names, False)
else:
_logger.info(
"Cache disabled and no new database name provided. " "Nothing to do."
"Cache disabled and no new database name provided. Nothing to do."
)
else:
with pg_connect() as pgcr:
Expand Down
3 changes: 1 addition & 2 deletions click_odoo_contrib/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,7 @@ def _get_modules_to_update(cr, ignore_addons=None):
modules_to_update = []
checksums = _load_installed_checksums(cr)
cr.execute(
"SELECT name FROM ir_module_module "
"WHERE state in ('installed', 'to upgrade')"
"SELECT name FROM ir_module_module WHERE state in ('installed', 'to upgrade')"
)
for (module_name,) in cr.fetchall():
if not _is_installable(module_name):
Expand Down
6 changes: 3 additions & 3 deletions tests/test_initdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ def test_create_cmd_cache(dbcache, tmpdir):
try:
subprocess.check_call(cmd)
with click_odoo.OdooEnvironment(database=TEST_DBNAME_NEW) as env:
assert env["ir.module.module"].search(
[("name", "=", "addon1")]
), "module addon1 not present in new database"
assert env["ir.module.module"].search([("name", "=", "addon1")]), (
"module addon1 not present in new database"
)
finally:
_dropdb(TEST_DBNAME_NEW)

Expand Down

0 comments on commit d1ab95b

Please sign in to comment.