def test_load_not_dict(): lockfile_path = os.path.join(EXAMPLE_LOCKFILE_DIR, 'not_dict.yml') with open(lockfile_path, 'r') as lfd: with pytest.raises(exceptions.GalaxyClientError) as exc_info: collections_lockfile.load(lfd) log.debug('exc_info: %s', exc_info)
def test_load_floating(): lockfile_path = os.path.join(EXAMPLE_LOCKFILE_DIR, 'floating.yml') with open(lockfile_path, 'r') as lfd: lockfile = collections_lockfile.load(lfd) assert isinstance(lockfile, CollectionsLockfile) assert 'alikins.collection_inspect' in lockfile.dependencies assert 'alikins.collection_ntp' in lockfile.dependencies assert lockfile.dependencies['alikins.collection_inspect'] == '*' assert lockfile.dependencies['alikins.collection_ntp'] == '*'
def test_load_explicit_start(): lockfile_path = os.path.join(EXAMPLE_LOCKFILE_DIR, 'explicit_start.yml') with open(lockfile_path, 'r') as lfd: lockfile = collections_lockfile.load(lfd) assert isinstance(lockfile, CollectionsLockfile) assert 'alikins.collection_inspect' in lockfile.dependencies assert 'alikins.collection_ntp' in lockfile.dependencies assert lockfile.dependencies['alikins.collection_inspect'] == '*' assert lockfile.dependencies['example2.name'] == '>=2.3.4,!=1.0.0'
def load_collections_lockfile(lockfile_path): try: log.debug('Opening the collections lockfile %s', lockfile_path) with open(lockfile_path, 'r') as lffd: return collections_lockfile.load(lffd) except EnvironmentError as exc: log.exception(exc) msg = 'Error opening the collections lockfile "%s": %s' % (lockfile_path, exc) log.error(msg) raise exceptions.GalaxyClientError(msg)