fix(tests): fixed db migration tests after introduction of RC_TEST flag

This commit is contained in:
RhodeCode Admin 2024-03-12 10:08:17 +01:00
parent f8bdbc4c72
commit 15fd720c89
2 changed files with 5 additions and 2 deletions

View file

@ -87,5 +87,5 @@ __license__ = 'AGPLv3, and Commercial License'
__author__ = 'RhodeCode GmbH'
__url__ = 'https://code.rhodecode.com'
is_test = os.getenv('RC_TEST')
is_test = os.getenv('RC_TEST', '0') == '1'
disable_error_handler = False

View file

@ -89,6 +89,7 @@ class DBBackend(object):
'startup.import_repos': 'false'}}]
_db_url = [{'app:main': {'sqlalchemy.db1.url': ''}}]
_base_db_name = 'rhodecode_test_db_backend'
std_env = {'RC_TEST': '0'}
def __init__(
self, config_file, db_name=None, basetemp=None,
@ -134,13 +135,15 @@ class DBBackend(object):
"""
command = cmd + ' ' + ' '.join(args)
sys.stdout.write(command)
sys.stdout.write(f'CMD: {command}')
# Tell Python to use UTF-8 encoding out stdout
_env = os.environ.copy()
_env['PYTHONIOENCODING'] = 'UTF-8'
_env.update(self.std_env)
if env:
_env.update(env)
self.p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE, env=_env)
self.stdout, self.stderr = self.p.communicate()
stdout_str = safe_str(self.stdout)