From 15fd720c8945b549bfa69be969a5715bd4a96604 Mon Sep 17 00:00:00 2001 From: RhodeCode Admin Date: Tue, 12 Mar 2024 10:08:17 +0100 Subject: [PATCH] fix(tests): fixed db migration tests after introduction of RC_TEST flag --- rhodecode/__init__.py | 2 +- rhodecode/tests/database/conftest.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/rhodecode/__init__.py b/rhodecode/__init__.py index 2d6446aa..82a7f06a 100644 --- a/rhodecode/__init__.py +++ b/rhodecode/__init__.py @@ -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 diff --git a/rhodecode/tests/database/conftest.py b/rhodecode/tests/database/conftest.py index 7799f23c..0bd2c0b3 100644 --- a/rhodecode/tests/database/conftest.py +++ b/rhodecode/tests/database/conftest.py @@ -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)