# HG changeset patch # User Mads Kiilerich # Date 1602353091 -7200 # Node ID 3afc6bff84bb82daa0a41e0d578279c7821dcdbe # Parent 30aac95e7fd556df71eb1fb38927a915afd9260f db_manage: drop special DbManage mode for tests There is no need for a special mode - just use force_ask to answer yes to "destroy old database". diff -r 30aac95e7fd5 -r 3afc6bff84bb kallithea/lib/db_manage.py --- a/kallithea/lib/db_manage.py Sat Oct 10 19:59:54 2020 +0200 +++ b/kallithea/lib/db_manage.py Sat Oct 10 20:04:51 2020 +0200 @@ -49,9 +49,8 @@ class DbManage(object): - def __init__(self, dbconf, root, tests=False, SESSION=None, cli_args=None): + def __init__(self, dbconf, root, SESSION=None, cli_args=None): self.dbname = dbconf.split('/')[-1] - self.tests = tests self.root = root self.dburi = dbconf self.cli_args = cli_args or {} @@ -87,10 +86,9 @@ else: log.info("The existing database %r will be destroyed and a new one created." % database) - if not self.tests: - if not self._ask_ok('Are you sure to destroy old database? [y/n]'): - print('Nothing done.') - sys.exit(0) + if not self._ask_ok('Are you sure to destroy old database? [y/n]'): + print('Nothing done.') + sys.exit(0) if reuse_database: Base.metadata.drop_all() @@ -197,7 +195,7 @@ if _path is not None: path = _path - elif not self.tests and not test_repo_path: + elif not test_repo_path: path = input( 'Enter a valid absolute path to store repositories. ' 'All repositories in that path will be added automatically:' diff -r 30aac95e7fd5 -r 3afc6bff84bb kallithea/tests/fixture.py --- a/kallithea/tests/fixture.py Sat Oct 10 19:59:54 2020 +0200 +++ b/kallithea/tests/fixture.py Sat Oct 10 20:04:51 2020 +0200 @@ -366,8 +366,8 @@ os.makedirs(repos_test_path) dbmanage = DbManage(dbconf=dbconf, root=config['here'], - tests=True, cli_args={ + 'force_ask': True, 'username': TEST_USER_ADMIN_LOGIN, 'password': TEST_USER_ADMIN_PASS, 'email': TEST_USER_ADMIN_EMAIL,