Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
Testing

When writing python katas, you might want to create modules that can be imported by the solution or tests.

This kata shows how to by manipulating sys.path to allow importing from /home/codewarrior folder and writing a python file there.

import sys
HOME_DIR = '/home/codewarrior'

def make_module(module_name):
    if HOME_DIR not in sys.path:
        sys.path.append(HOME_DIR)

    moduleContent = 'foo = lambda x: x+1'
    with open('{}/{}.py'.format(HOME_DIR, module_name), 'w') as moduleFile:
        moduleFile.write(moduleContent)