コード例 #1
0
def test_first_directory_propagates_lstat_exceptions(tmpdir):
    """
    If first_directory's lstat raises an exception that isn't ENOENT, it will
    be propagated upward.
    """
    d = tmpdir.join('d')
    d.mkdir()
    tmpdir.chmod(0)
    with pytest.raises(OSError):
        runit_sv.first_directory([d.strpath])
コード例 #2
0
def test_first_directory_propagates_lstat_exceptions(tmpdir):
    """
    If first_directory's lstat raises an exception that isn't ENOENT, it will
    be propagated upward.
    """
    d = tmpdir.join('d')
    d.mkdir()
    tmpdir.chmod(0)
    with pytest.raises(OSError):
        runit_sv.first_directory([d.strpath])
コード例 #3
0
def test_first_directory(tmpdir, inputs, expected):
    """
    first_directory will return the first extant true directory (i.e. not a
    symlink) or None if none exist.
    """
    inputs = [make_path(tmpdir, x) for x in inputs]
    result = runit_sv.first_directory(inputs)
    if expected is None:
        assert result is None
    else:
        assert result == inputs[expected]
コード例 #4
0
def test_first_directory(tmpdir, inputs, expected):
    """
    first_directory will return the first extant true directory (i.e. not a
    symlink) or None if none exist.
    """
    inputs = [make_path(tmpdir, x) for x in inputs]
    result = runit_sv.first_directory(inputs)
    if expected is None:
        assert result is None
    else:
        assert result == inputs[expected]