def test_missing_manifest_doc_repo_fields(demo_manifest, key): """Test that exceptions are raised when a manifest is missing required fields in the 'doc_repo' object """ manifest = ruamel.yaml.load(demo_manifest) del manifest['doc_repo'][key] with pytest.raises(ValidationError): Manifest.validate(manifest)
def test_missing_manifest_package_fields(demo_manifest, key): """Test that exceptions are raised when a manifest is missing required fields in the 'packages.packages.afw' object. """ manifest = ruamel.yaml.load(demo_manifest) del manifest['packages']['afw'][key] with pytest.raises(ValidationError): Manifest.validate(manifest)
def test_doc_repo_data(demo_manifest): manifest = Manifest(demo_manifest) assert 'pipelines_docs' == manifest.doc_repo_name assert 'master' == manifest.doc_repo_ref assert 'https://github.com/lsst-sqre/pipelines_docs.git' \ == manifest.doc_repo_url assert 'lsst_apps' == manifest.product_name assert 'b1' == manifest.build_id assert 'jonathansick' == manifest.requester_github_handle assert ['master'] == manifest.refs assert 'https://github.com/lsst/afw.git' == manifest.packages['afw']['url'] assert '/mnt/stack_docs/lsstsw/stack/Linux64/afw/2015_10.0-14-g7c5ed66' \ == manifest.packages['afw']['dir'] assert 'master' == manifest.packages['afw']['ref']
def product(request, mock_manifest): """Run the full product build pipeline. Since this fixture is session scoped it will only be run once; the tests then inspect the built product. The built documentation is automatically cleaned up with a finalizer. """ build_dir = tempfile.mkdtemp() manifest = Manifest(mock_manifest) product = Product(manifest, build_dir) product.clone_doc_repo() product.link_package_repos() product.build_sphinx() def cleanup(): shutil.rmtree(build_dir) request.addfinalizer(cleanup) return product
def test_bad_refs_type(demo_manifest): """Test that refs is a list.""" manifest = ruamel.yaml.load(demo_manifest) manifest['refs'] = 'master' with pytest.raises(ValidationError): Manifest.validate(manifest)
def test_manifest_roundtrip(demo_manifest): # Can't get perfect round-trip equality of the YAML manifest = Manifest(demo_manifest) assert manifest.yaml == demo_manifest
def demo_manifest(): resource_args = (__name__, 'demo_manifest.yaml') assert pkg_resources.resource_exists(*resource_args) yaml_data = pkg_resources.resource_string(*resource_args) manifest = Manifest(yaml_data) return manifest