# HG changeset patch # User Mads Kiilerich # Date 2020-10-10 20:04:51 # 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 --git a/kallithea/lib/db_manage.py b/kallithea/lib/db_manage.py --- a/kallithea/lib/db_manage.py +++ b/kallithea/lib/db_manage.py @@ -49,9 +49,8 @@ log = logging.getLogger(__name__) 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 @@ class DbManage(object): 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 @@ class DbManage(object): 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 --git a/kallithea/tests/fixture.py b/kallithea/tests/fixture.py --- a/kallithea/tests/fixture.py +++ b/kallithea/tests/fixture.py @@ -366,8 +366,8 @@ def create_test_env(repos_test_path, con 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,