def test_create_test_files():
    project_name = "balloonpants"
    projectfolders.create_folders(project_name, target_dir) #Create the project folders
    project_root = projectfolders.create_path(target_dir, project_name)
    projectfiles.write_tests(project_name, project_root)
    
    assert_file_exists(project_root, "tests", "%s_tests.py" % project_name)
def test_create_setup_file():
    project_name = "hipster-tears"
    projectfolders.create_folders(project_name, target_dir) #Create the project folders
    project_root = projectfolders.create_path(target_dir, project_name)
    projectfiles.write_setup(project_name, project_root)
    
    assert_file_exists(project_root, None, "setup.py")
Beispiel #3
0
def test_create_setup_file():
    project_name = "hipster-tears"
    projectfolders.create_folders(project_name, target_dir) #Create the project folders
    project_root = projectfolders.create_path(target_dir, project_name)
    projectfiles.write_setup(project_name, project_root)
    
    assert_file_exists(project_root, None, "setup.py")
Beispiel #4
0
def test_create_test_files():
    project_name = "balloonpants"
    projectfolders.create_folders(project_name, target_dir) #Create the project folders
    project_root = projectfolders.create_path(target_dir, project_name)
    projectfiles.write_tests(project_name, project_root)

    assert_file_exists(project_root, "tests", "{project_name}_tests.py".format(project_name=project_name))
def test_create_init_files():
    project_name = "hammertime"
    projectfolders.create_folders(project_name, target_dir) #Create the project folders
    project_root = projectfolders.create_path(target_dir, project_name)
    projectfiles.write_inits(project_name, project_root)
    
    assert_file_exists(project_root, "tests", "__init__.py")
    assert_file_exists(project_root, project_name, "__init__.py")
Beispiel #6
0
def create_files(project_name, root_dir):
    """Creates all files necessary for a project skeleton"""
    root_dir = projectfolders.create_path(root_dir,
                                          project_name)  #Modify the root

    write_setup(project_name, root_dir)
    write_inits(project_name, root_dir)
    write_tests(project_name, root_dir)
Beispiel #7
0
def get_file_path(root_dir, sub_dir, filename):
    if sub_dir == None:  #In case we're writing directly to the root directory
        return os.path.normpath(os.path.join(root_dir, filename))

    #Otherwise, build out the appropriate path for the subdirectory
    path_ = projectfolders.create_path(root_dir, sub_dir)
    filepath = os.path.join(path_, filename)
    return os.path.normpath(filepath)
Beispiel #8
0
def test_create_init_files():
    project_name = "hammertime"
    projectfolders.create_folders(project_name, target_dir) #Create the project folders
    project_root = projectfolders.create_path(target_dir, project_name)
    projectfiles.write_inits(project_name, project_root)
    
    assert_file_exists(project_root, "tests", "__init__.py")
    assert_file_exists(project_root, project_name, "__init__.py")
def test_create_init_files():
    project_name = 'hammertime'
    # Create the project folders
    projectfolders.create_folders(project_name, test_dir)
    project_root = projectfolders.create_path(test_dir, project_name)
    projectfiles.write_inits(project_name, project_root)

    assert_file_exists(project_root, 'tests', '__init__.py')
    assert_file_exists(project_root, project_name, '__init__.py')
def test_create_all_files():
    """Bring all of the individual file tests together under one roof..."""
    project_name = "mongodb-is-webscale-webscale-i-tells-ya"
    projectfolders.create_folders(project_name, target_dir) #Create the project folders
    project_root = projectfolders.create_path(target_dir, project_name)
    projectfiles.create_files(project_name, target_dir) #Oh snap, notice how we're using target_dir? This method creates a project root internally.
    
    assert_file_exists(project_root, "tests", "__init__.py")
    assert_file_exists(project_root, project_name, "__init__.py")
    assert_file_exists(project_root, "tests", "%s_tests.py" % project_name)
    assert_file_exists(project_root, None, "setup.py")
Beispiel #11
0
def test_create_all_files():
    """Bring all of the individual file tests together under one roof..."""
    project_name = "mongodb-is-webscale-webscale-i-tells-ya"
    projectfolders.create_folders(project_name, target_dir) #Create the project folders
    project_root = projectfolders.create_path(target_dir, project_name)
    projectfiles.create_files(project_name, target_dir) #Oh snap, notice how we're using target_dir? This method creates a project root internally.
    
    assert_file_exists(project_root, "tests", "__init__.py")
    assert_file_exists(project_root, project_name, "__init__.py")
    assert_file_exists(project_root, "tests", "{project_name}_tests.py".format(project_name=project_name))
    assert_file_exists(project_root, None, "setup.py")
def test_create_all_files():
    '''Bring all of the individual file tests together under one roof...'''
    project_name = 'mongodb-is-webscale-webscale-i-tells-ya'
    # Create the project folders
    projectfolders.create_folders(project_name, test_dir)
    project_root = projectfolders.create_path(test_dir, project_name)
    # Oh snap, notice how we're using test_dir? This method creates a
    # project root internally.
    projectfiles.create_files(project_name, test_dir)

    assert_file_exists(project_root, 'tests', '__init__.py')
    assert_file_exists(project_root, project_name, '__init__.py')
    assert_file_exists(project_root, None, 'setup.py')
def create_files(project_name, root_dir):
    '''Creates all files necessary for a project skeleton'''
    dest_dir = projectfolders.create_path(
        root_dir,  # Modify the root
        project_name,
    )

    write_inits(project_name, dest_dir)

    templates = find_templates()

    template_dir = get_template_dir()

    for template in templates:
        template_name = get_template_name(template)
        contents = io.open(os.path.join(template_dir, template)).read()
        if template_name in FILE_MAPPINGS:
            contents = FILE_MAPPINGS[template_name](contents, project_name)

        with io.open(os.path.join(dest_dir, template_name), 'w') as file_obj:
            file_obj.write(contents)
def test_create_folder_path():
    sub_dir = "magicdir"
    expected_path = os.path.join(os.path.normpath(target_dir), sub_dir)
    resultant_path = projectfolders.create_path(target_dir, sub_dir)
    assert expected_path == resultant_path
Beispiel #15
0
def test_create_folder_path():
    sub_dir = "magicdir"
    expected_path = os.path.join(os.path.normpath(target_dir), sub_dir)
    resultant_path = projectfolders.create_path(target_dir, sub_dir)
    assert expected_path == resultant_path