Compare commits
2 Commits
0d3006dbdb
...
pdf
Author | SHA1 | Date | |
---|---|---|---|
03ecab9755 | |||
ec59663c39 |
File diff suppressed because it is too large
Load Diff
@ -35,7 +35,7 @@ commands =
|
||||
{[testenv:json-{{ doc.type }}]commands}
|
||||
{%- endfor %}
|
||||
|
||||
[testenv:docs-pdf]
|
||||
[testenv:pdf-docs]
|
||||
deps = -r{toxinidir}/doc/requirements.txt
|
||||
allowlist_externals =
|
||||
rm
|
||||
|
@ -21,45 +21,8 @@ Tests for `otc-metadata` module.
|
||||
|
||||
from unittest import TestCase
|
||||
|
||||
from otc_metadata import services
|
||||
|
||||
|
||||
class TestOtcMetadata(TestCase):
|
||||
def setUp(self):
|
||||
self.data = services.Services()
|
||||
|
||||
def test_data_is_sorted(self):
|
||||
curr = self.data
|
||||
new = services.Services()
|
||||
new._sort_data()
|
||||
self.assertEqual(
|
||||
curr._service_data, new._service_data, "Data is sorted properly"
|
||||
)
|
||||
|
||||
def test_service_categories(self):
|
||||
category = dict()
|
||||
for cat in self.data._service_data["service_categories"]:
|
||||
category[cat["name"]] = cat["title"]
|
||||
for srv in self.data.all_services:
|
||||
self.assertTrue(
|
||||
srv["service_category"] in category,
|
||||
f"Category {srv['service_category']} is present",
|
||||
)
|
||||
|
||||
def test_doc_contains_required_data(self):
|
||||
srv_types = dict()
|
||||
for srv in self.data.all_services:
|
||||
srv_types[srv["service_type"]] = srv
|
||||
for doc in self.data.all_docs:
|
||||
for attr in [
|
||||
"rst_location",
|
||||
"service_type",
|
||||
"title",
|
||||
"type",
|
||||
]:
|
||||
self.assertIn(attr, doc, f"Document {doc} contains {attr}")
|
||||
self.assertIn(
|
||||
doc["service_type"],
|
||||
srv_types,
|
||||
f"Document {doc} contains valid service_type",
|
||||
)
|
||||
def test_something(self):
|
||||
pass
|
||||
|
@ -130,6 +130,7 @@ def process_repositories(args, service):
|
||||
zuul_templates = None
|
||||
zuul_jobs = dict()
|
||||
zuul_new_jobs = list()
|
||||
zuul_vars = dict()
|
||||
zuul_config_updated = False
|
||||
for item in zuul_config:
|
||||
if "project" in item.keys():
|
||||
@ -137,10 +138,11 @@ def process_repositories(args, service):
|
||||
zuul_templates = project.setdefault("templates", [])
|
||||
if not zuul_templates:
|
||||
zuul_templates = []
|
||||
zuul_vars = project.setdefault("vars", {})
|
||||
elif "job" in item.keys():
|
||||
job = item["job"]
|
||||
zuul_jobs[job["name"]] = job
|
||||
print(f"Existing jobs {zuul_jobs}")
|
||||
logging.debug(f"Existing jobs {zuul_jobs}")
|
||||
if "helpcenter-base-jobs" not in zuul_templates:
|
||||
zuul_templates.append("helpcenter-base-jobs")
|
||||
zuul_config_updated = True
|
||||
@ -148,6 +150,7 @@ def process_repositories(args, service):
|
||||
job_suffix = (
|
||||
"-hc-int-jobs" if args.environment == "internal" else "-hc-jobs"
|
||||
)
|
||||
sphinx_pdf_files = zuul_vars.setdefault('sphinx_pdf_files', [])
|
||||
for doc in data.docs_by_service_type(service["service_type"]):
|
||||
logging.debug(f"Analyzing document {doc}")
|
||||
if not doc.get("type"):
|
||||
@ -156,6 +159,12 @@ def process_repositories(args, service):
|
||||
doc_type = "dev-guide"
|
||||
else:
|
||||
doc_type = doc["type"]
|
||||
# Collect all PDF files into sphinx_pdf_files var
|
||||
pdf_name = doc.get('pdf_name')
|
||||
if pdf_name and f"{pdf_name}.pdf" not in sphinx_pdf_files:
|
||||
sphinx_pdf_files.append(f"{pdf_name}.pdf")
|
||||
zuul_config_updated = True
|
||||
|
||||
template_name = f"{doc_type}{job_suffix}"
|
||||
if doc_type in ["api-ref", "umn", "dev-guide"]:
|
||||
if template_name not in zuul_templates:
|
||||
@ -190,6 +199,7 @@ def process_repositories(args, service):
|
||||
if "project" in item.keys():
|
||||
project = item["project"]
|
||||
project["templates"] = zuul_templates
|
||||
project["vars"] = zuul_vars
|
||||
# Ensure new jobs are in check
|
||||
if len(zuul_new_jobs) > 0:
|
||||
project.setdefault(
|
||||
|
1
tox.ini
1
tox.ini
@ -19,6 +19,7 @@ commands = {posargs}
|
||||
|
||||
[flake8]
|
||||
# E123, E125 skipped as they are invalid PEP-8.
|
||||
|
||||
show-source = True
|
||||
ignore = E123,E125,W503
|
||||
builtins = _
|
||||
|
Reference in New Issue
Block a user