If testing using sqlite, the with setting DB_NAME. It will use same dbname after testing. Running the first time, it will not problem. But running the second time, it will show “There is 1 other sessions using the database”. So, I will need to change the DB_NAME for next test.
Is it common? or I had other setting is wrong?
Traceback (most recent call last):
File "/project/trytond/src/abj/.tox/py3.11-sqlite/lib/python3.11/site-packages/trytond/tests/test_tryton.py", line 290, in setUpClass
drop_db()
File "/project/trytond/src/abj/.tox/py3.11-sqlite/lib/python3.11/site-packages/trytond/tests/test_tryton.py", line 1080, in drop_db
database.drop(transaction.connection, name)
File "/project/trytond/src/abj/.tox/py3.11-sqlite/lib/python3.11/site-packages/trytond/backend/postgresql/database.py", line 309, in drop
cursor.execute(SQL("DROP DATABASE {}")
File "/project/trytond/src/abj/.tox/py3.11-sqlite/lib/python3.11/site-packages/trytond/backend/postgresql/database.py", line 68, in execute
cursor.execute(self, sql, args)
psycopg2.errors.ObjectInUse: database "testdb1" is being accessed by other users
DETAIL: There is 1 other session using the database.
Are you sure you are using sqlite for testing? The traceback you pasted shows you are using a postgres database so it may be possible that there is a connection in other side that prevents its removal.
Probably you have the TRYTOND_CONFIG environment variable pointing to a file that has the postgres backend. You must clear that environemnt variable to ensure the tests are running on sqlite