# HG changeset patch # User RhodeCode Admin # Date 2024-03-12 09:08:17 # Node ID adc169b493c11dd8148c5d265c2f1555c72a4fb4 # Parent f929688ea578fc8333c98c09e875a0eba92066a9 fix(tests): fixed db migration tests after introduction of RC_TEST flag diff --git a/rhodecode/__init__.py b/rhodecode/__init__.py --- a/rhodecode/__init__.py +++ b/rhodecode/__init__.py @@ -87,5 +87,5 @@ EXTENSIONS = {} __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 --- 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)