def composite_stage_with_expanding_resource( mock_archive, mock_expand_resource): composite_stage = StageComposite() root_stage = Stage(mock_archive.url) composite_stage.append(root_stage) test_resource_fetcher = spack.fetch_strategy.from_kwargs( url=mock_expand_resource.url) # Specify that the resource files are to be placed in the 'resource-dir' # directory test_resource = Resource( 'test_resource', test_resource_fetcher, '', 'resource-dir') resource_stage = ResourceStage( test_resource_fetcher, root_stage, test_resource) composite_stage.append(resource_stage) return composite_stage, root_stage, resource_stage
def test_composite_stage_with_noexpand_resource( self, mock_archive, mock_noexpand_resource): composite_stage = StageComposite() root_stage = Stage(mock_archive.url) composite_stage.append(root_stage) resource_dst_name = 'resource-dst-name.sh' test_resource_fetcher = spack.fetch_strategy.from_kwargs( url='file://' + mock_noexpand_resource, expand=False) test_resource = Resource( 'test_resource', test_resource_fetcher, resource_dst_name, None) resource_stage = ResourceStage( test_resource_fetcher, root_stage, test_resource) composite_stage.append(resource_stage) composite_stage.create() composite_stage.fetch() composite_stage.expand_archive() assert os.path.exists( os.path.join(composite_stage.source_path, resource_dst_name))