Пример #1
0
def _resolve_one_path(paths):  # #open [#008.4]
    if 1 == len(paths):
        return paths[0]
    paths = tuple({k: None for k in paths}.keys())  # set, preserve order
    leng = len(paths)
    if 1 == leng:
        return paths[0]
    if 2 < leng:
        assert()
    from logging import warning as func
    left, right = paths
    func(f"symlink? #open [#008.4] this hacky business:\n  {left}\n  {right}")
    return left
Пример #2
0
def spy_on_write_and_lines_for(tc, debug_prefix):
    # (this pretend resource for capturing output is at top.
    # the rest in this sections are for mocking input)

    from script_lib.test_support.expect_STDs import \
        spy_on_write_and_lines_for as func
    return func(tc, debug_prefix, isatty=None)
Пример #3
0
def didactic_collectioner():
    import kiss_rdb_test.fixture_code._1416_SAs._33_SAs as mod
    # == BEGIN #open [#008.4]
    path = mod.__path__
    fs_path = _resolve_one_path(mod.__path__)
    from kiss_rdb.magnetics_.collection_via_path import \
        collectioner_via_storage_adapters_module as func
    return func(path._name, fs_path)
Пример #4
0
def _pretend_resource(lines, pretend_path, expect_num_rewinds=None, **kw):
    # The fork-in-the-road (we might push up): controller or no controller
    # based on the presence of one option

    assert hasattr(lines, '__next__')  # [#022]
    if expect_num_rewinds is None:
        fh = fake_file_via_path_and_lines(pretend_path, lines, **kw)
        return fh, None  # #here1
    from modality_agnostic.test_support.mock_filehandle import \
        mock_filehandle_and_mutable_controller_via as func
    return func(expect_num_rewinds, lines, pretend_path=pretend_path, **kw)
Пример #5
0
def _work(dirname, coll_dir, listener, is_dry):
    ok = _apply_big_patchfile(dirname, coll_dir, listener, is_dry)
    if not ok:
        raise _Stop()

    # Now we have made the changes on the filesystem.
    # Do we want mutable or read-only collection? If mutable, we
    # need all those special arguments like rng...

    from kiss_rdb.storage_adapters_ import eno as sa_mod

    kw = {'do_load_schema_from_filesystem': (not is_dry)}

    from kiss_rdb.magnetics_.collection_via_path import \
        collection_via_storage_adapter_module_and_path_ as func

    return func(sa_mod, coll_dir, listener, kw)
Пример #6
0
def fake_file_via_path_and_lines(path, lines, **kw):
    if isinstance(lines, tuple):
        lines = iter(lines)
    from modality_agnostic.test_support.mock_filehandle import \
        mock_filehandle as func
    return func(lines, path, **kw)