Exemplo n.º 1
0
def test_get_requirement_files_case2(chdir):
    file.get_req_filename('dev')
    file.get_req_filename('test')
    assert file.get_req_filenames() == {
        'dev-requirements.txt',
        'requirements.txt',
        'test-requirements.txt',
    }
Exemplo n.º 2
0
def test_get_requirement_files(chdir):
    os.mkdir('requirements')
    base_fname = os.path.join('requirements', 'base.txt')
    open(base_fname, 'wb').close()
    file.get_req_filename('dev')
    file.get_req_filename('test')
    assert file.get_req_filenames() == {
        'requirements/development.txt',
        'requirements/base.txt',
        'requirements/test.txt',
    }
Exemplo n.º 3
0
def test_get_req_filename_case2(chdir):
    """
        test it creates inside requirements directory
    """
    file.get_req_filename()  # create requirements.txt
    rb = chdir.mkdir('requirements').join('base.txt')
    rb.write('test')
    assert file.get_req_filename('test') == 'requirements/test.txt'
    assert {'base.txt', 'test.txt'
            } == set(os.listdir(os.path.join(os.curdir, 'requirements')))

    # test it return base name when dir exists
    assert file.get_req_filename() == 'requirements/base.txt'
Exemplo n.º 4
0
def test_fill_args_when_no_args_given_all(chdir):
    """

    Args:
        tmpdir (LocalPath): fixture

    """
    # create the below two files
    get_req_filename("dev")
    get_req_filename("test")

    # start test
    fset = get_req_filenames()
    cmd = commands.InstallCommandPlus("i", "i")
    opts, args = cmd.parse_args(["--all"])
    assert set(opts.requirements) == fset
Exemplo n.º 5
0
def test_fill_args_when_no_args_given(chdir):
    """

    Args:
        tmpdir (LocalPath): fixture

    """
    f = get_req_filename()
    cmd = commands.InstallCommandPlus("i", "i")
    opts, args = cmd.parse_args([])
    assert opts.requirements == [f]
Exemplo n.º 6
0
def test_fill_args_when_no_args_given_dev(chdir):
    """

    Args:
        tmpdir (LocalPath): fixture

    """
    for env in ["dev", "test", "prod"]:
        f = get_req_filename(env)
        cmd = commands.InstallCommandPlus("i", "i")
        opts, args = cmd.parse_args(["--{}".format(env)])
        assert opts.requirements == [f]
Exemplo n.º 7
0
def test_get_req_filename(chdir):
    assert file.get_req_filename('dev') == 'dev-requirements.txt'
    assert {'dev-requirements.txt',
            'requirements.txt'} == set(os.listdir(os.curdir))
Exemplo n.º 8
0
def test_parse_comes_from_case_nofile(chdir):
    fname, line = file.parse_comes_from(None, 'dev')
    assert fname == file.get_req_filename('dev')
    assert line is None