예제 #1
0
def test__mkdir_p(mockfs):
    mkdir_p("/pants/a/b/c")

    assert os.path.isdir("/pants")
    assert os.path.isdir("/pants/a")
    assert os.path.isdir("/pants/a/b")
    assert os.path.isdir("/pants/a/b/c")
예제 #2
0
def test__mkdir_p(mockfs):
    mkdir_p("/pants/a/b/c")

    assert os.path.isdir("/pants")
    assert os.path.isdir("/pants/a")
    assert os.path.isdir("/pants/a/b")
    assert os.path.isdir("/pants/a/b/c")
예제 #3
0
def write_config(path="spec/javascripts/support/jasmine.yml"):
    mkdir_p(os.path.dirname(path))
    with open(path, "w") as f:
        f.write("""
            src_dir: src
            spec_dir: spec
            """)
예제 #4
0
def write_config(path="spec/javascripts/support/jasmine.yml"):
    mkdir_p(os.path.dirname(path))
    with open(path, "w") as f:
        f.write("""
            src_dir: src
            spec_dir: spec
            """)
예제 #5
0
def test__mkdir_p():
    with in_temp_dir():
        mkdir_p("pants/a/b/c")

        assert os.path.isdir("pants")
        assert os.path.isdir("pants/a")
        assert os.path.isdir("pants/a/b")
        assert os.path.isdir("pants/a/b/c")
예제 #6
0
def test__mkdir_p():
    with in_temp_dir():
        mkdir_p("pants/a/b/c")
    
        assert os.path.isdir("pants")
        assert os.path.isdir("pants/a")
        assert os.path.isdir("pants/a/b")
        assert os.path.isdir("pants/a/b/c")
예제 #7
0
def test__mkdir_p_error(mockfs, monkeypatch):
    def raise_error(path):
        o = OSError()
        o.errno = errno.EEXIST
        raise o

    monkeypatch.setattr(os, 'makedirs', raise_error)
    mockfs.add_entries({'/pants/a/b/c': {}})
    mkdir_p("/pants/a/b/c")
예제 #8
0
def test__mkdir_p_error(mockfs, monkeypatch):
    def raise_error(path):
        o = OSError()
        o.errno = errno.EEXIST
        raise o

    monkeypatch.setattr(os, 'makedirs', raise_error)
    mockfs.add_entries({
        '/pants/a/b/c': {}
    })
    mkdir_p("/pants/a/b/c")
예제 #9
0
def test_init__yes__existing_yaml(monkeypatch):
    with in_temp_dir():
        mkdir_p("spec/javascripts/support")
        with open("spec/javascripts/support/jasmine.yml", "w") as f:
            f.write("""
                spec_files:
                    - "**/pants.*"
                """)
        # Should NOT overwrite spec/javascripts/support/jasmine.yml
        spec_dir = "spec/javascripts/support"
        yaml_file = os.path.join(spec_dir, "jasmine.yml")

        input_string(monkeypatch, "Y")

        Command(None, None).init(None)

        assert os.path.isdir(spec_dir)
        assert os.path.isfile(yaml_file)

        yaml = load(open(yaml_file))

        assert yaml['spec_files'] == ["**/pants.*"]
예제 #10
0
def test_init__yes__existing_yaml(monkeypatch):
    with in_temp_dir():
        mkdir_p("spec/javascripts/support")
        with open("spec/javascripts/support/jasmine.yml", "w") as f:
            f.write("""
                spec_files:
                    - "**/pants.*"
                """)
        # Should NOT overwrite spec/javascripts/support/jasmine.yml
        spec_dir = "spec/javascripts/support"
        yaml_file = os.path.join(spec_dir, "jasmine.yml")
    
        input_string(monkeypatch, "Y")
    
        Command(None, None).init(None)
    
        assert os.path.isdir(spec_dir)
        assert os.path.isfile(yaml_file)
    
        yaml = load(open(yaml_file))
    
        assert yaml['spec_files'] == ["**/pants.*"]