def get_help_to_defined_convention(convention, debug_mode): debug('recieved convention for help catch', convention, debug_mode) if convention == 'angular': print_help(angular_convention_help) elif convention == 'tagged': print_help(tagged_convention_help) elif convention == 'karma': print_help(karma_convention_help) elif convention == 'symphony': print_help(symphony_convention_help) elif convention == 'atom': print_help(atom_convention_help) else: print(MIN_ERROR + 'The chosen convention has no helper!' + RESET)
def custom_convention(tag, message, config_file, debug_mode): debug('tag', tag, debug_mode) debug('message', message, debug_mode) debug('pattern from file', config_file['commit_pattern'], debug_mode) pattern = str(config_file['commit_pattern'] or '') debug('pattern acquired', pattern, debug_mode) context = '' pattern = pattern.replace('tag', str(tag)) pattern = pattern.replace('message', str(message)) if config_file['context']: context = get_context() pattern = pattern.replace('context', context) debug('pattern post replace', pattern, debug_mode) pattern += '\n' return pattern
def convention_help_handler(file_path, args, debug_mode): if file_path.is_file() and args.convention is '': debug('Found file for help', str(file_path), debug_mode) with open(str(file_path)) as target: try: config = safe_load(target) convention = dump_convention(config) debug('Convention captured', convention, debug_mode) except YAMLError as err: print(err) elif args.convention is not '': debug('Found convention in args', args, debug_mode) convention = args.convention else: print(MIN_ERROR + 'No convention was specified!' + RESET) return debug('convention captured for helper', convention, debug_mode) get_help_to_defined_convention(convention, debug_mode)
def test_no_debug(capsys): text_utils.debug('msg', 666, show=False) captured = capsys.readouterr() if captured.out != '': raise AssertionError()
def test_debug(capsys): text_utils.debug('msg', 666, show=True) captured = capsys.readouterr() if not captured.out == DEBUG_COLOR + "DEBUG: msg ~> 666" + RESET + "\n": raise AssertionError()