# HG changeset patch # User Marcin Kuzminski # Date 2017-04-27 19:37:53 # Node ID a62461f97e68b2b233fd5ad82ede1af830dd15d6 # Parent 1b64c19a6373ca497b412120050bf6402ac41e58 tests: added special no-newline test name generator diff --git a/rhodecode/tests/__init__.py b/rhodecode/tests/__init__.py --- a/rhodecode/tests/__init__.py +++ b/rhodecode/tests/__init__.py @@ -56,7 +56,7 @@ log = logging.getLogger(__name__) __all__ = [ 'get_new_dir', 'TestController', 'SkipTest', 'url', 'link_to', 'ldap_lib_installed', 'clear_all_caches', - 'assert_session_flash', 'login_user', + 'assert_session_flash', 'login_user', 'no_newline_id_generator', 'TESTS_TMP_PATH', 'HG_REPO', 'GIT_REPO', 'SVN_REPO', 'NEW_HG_REPO', 'NEW_GIT_REPO', 'HG_FORK', 'GIT_FORK', 'TEST_USER_ADMIN_LOGIN', 'TEST_USER_ADMIN_PASS', @@ -249,3 +249,17 @@ def assert_session_flash_is_empty(respon msg = 'flash messages are present in session:%s' % \ response.session['flash'][0] pytest.fail(safe_str(msg)) + + +def no_newline_id_generator(test_name): + """ + Generates a test name without spaces or newlines characters. Used for + nicer output of progress of test + """ + org_name = test_name + test_name = test_name\ + .replace('\n', '_N') \ + .replace('\t', '_T') \ + .replace(' ', '_S') + + return test_name or 'test-with-empty-name'