def test_import_json(dds: DDS): dds.scope.enter_context(ensure_dir(dds.build_dir)) dds.catalog_create() json_fpath = dds.build_dir / 'data.json' import_data = { 'version': 1, 'packages': { 'foo': { '1.2.4': { 'git': { 'url': 'http://example.com', 'ref': 'master', }, 'depends': {}, }, '1.2.5': { 'git': { 'url': 'http://example.com', 'ref': 'master', }, }, }, }, } dds.scope.enter_context( dds.set_contents(json_fpath, json.dumps(import_data).encode())) dds.catalog_import(json_fpath)
def test_get(dds: DDS): dds.scope.enter_context(ensure_dir(dds.build_dir)) dds.catalog_create() json_path = dds.build_dir / 'catalog.json' import_data = { 'version': 1, 'packages': { 'neo-sqlite3': { '0.3.0': { 'git': { 'url': 'https://github.com/vector-of-bool/neo-sqlite3.git', 'ref': '0.3.0', }, }, }, }, } dds.scope.enter_context( dds.set_contents(json_path, json.dumps(import_data).encode())) dds.catalog_import(json_path) dds.catalog_get('[email protected]') assert (dds.source_root / '[email protected]').is_dir() assert (dds.source_root / '[email protected]/package.jsonc').is_file()
def test_build_deps_from_file(dds: DDS): assert not dds.deps_build_dir.is_dir() dds.catalog_import(dds.source_root / 'catalog.json') dds.build_deps(['-d', 'deps.json5']) assert (dds.deps_build_dir / '[email protected]').is_dir() assert (dds.scratch_dir / 'INDEX.lmi').is_file() assert (dds.deps_build_dir / '_libman/neo-fun.lmp').is_file() assert (dds.deps_build_dir / '_libman/neo/fun.lml').is_file()
def test_multiple_deps(dds: DDS): assert not dds.deps_build_dir.is_dir() dds.catalog_import(dds.source_root / 'catalog.json') dds.build_deps(['neo-fun^0.2.0', 'neo-fun~0.3.0']) assert (dds.deps_build_dir / '[email protected]').is_dir() assert (dds.scratch_dir / 'INDEX.lmi').is_file() assert (dds.deps_build_dir / '_libman/neo-fun.lmp').is_file() assert (dds.deps_build_dir / '_libman/neo/fun.lml').is_file()