You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
install .whl file in </install/prefix>
run pytest with PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
Here is pytest output:
+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-kroki-1.3.0-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-kroki-1.3.0-2.fc35.x86_64/usr/lib/python3.8/site-packages+ /usr/bin/pytest -ra=========================================================================== test session starts ============================================================================platform linux -- Python 3.8.13, pytest-7.1.2, pluggy-1.0.0libraries: Sphinx-5.1.1, docutils-0.18.1base tempdir: /tmp/pytest-of-tkloczko/pytest-913rootdir: /home/tkloczko/rpmbuild/BUILD/kroki-1.3.0, configfile: pyproject.tomlcollected 1 itemtests/test_kroki.py F [100%]================================================================================= FAILURES =================================================================================_____________________________________________________________________________ test_kroki_html ______________________________________________________________________________builder = <sphinx.builders.html.StandaloneHTMLBuilder object at 0x7f4400c59d90>, diagram_type = 'mermaid', diagram_source = 'graph TD\n A[ Anyone ]', output_format = 'svg'diagram_options = {}, prefix = 'kroki' def render_kroki( builder: Builder, diagram_type: str, diagram_source: str, output_format: str, diagram_options: Dict[str, Any] = {}, prefix: str = "kroki", ) -> Path: kroki_url: str = builder.config.kroki_url payload: Dict[str, Union[str, Dict]] = { "diagram_source": diagram_source, "diagram_type": diagram_type, "diagram_options": diagram_options, "output_format": output_format, } hashkey = (str(kroki_url) + str(payload)).encode() fname = "%s-%s.%s" % (prefix, sha1(hashkey).hexdigest(), output_format) outfn = Path(builder.outdir).joinpath(builder.imagedir, fname) if outfn.is_file(): return outfn try: outfn.parent.mkdir(parents=True, exist_ok=True) response = requests.post(kroki_url, json=payload, stream=True)
> response.raise_for_status()../../BUILDROOT/python-sphinxcontrib-kroki-1.3.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/kroki/kroki.py:269:_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _self = <Response [500]> def raise_for_status(self): """Raises :class:`HTTPError`, if one occurred.""" http_error_msg = "" if isinstance(self.reason, bytes): # We attempt to decode utf-8 first because some servers # choose to localize their reason strings. If the string # isn't utf-8, we fall back to iso-8859-1 for all other # encodings. (See PR #3538) try: reason = self.reason.decode("utf-8") except UnicodeDecodeError: reason = self.reason.decode("iso-8859-1") else: reason = self.reason if 400 <= self.status_code < 500: http_error_msg = ( f"{self.status_code} Client Error: {reason} for url: {self.url}" ) elif 500 <= self.status_code < 600: http_error_msg = ( f"{self.status_code} Server Error: {reason} for url: {self.url}" ) if http_error_msg:
> raise HTTPError(http_error_msg, response=self)E requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://kroki.io//usr/lib/python3.8/site-packages/requests/models.py:1021: HTTPErrorThe above exception was the direct cause of the following exception:self = <sphinxcontrib.kroki.transform.KrokiToImageTransform object at 0x7f4400c5ff10>, node = <kroki: >, prefix = 'kroki' def render(self, node: kroki, prefix: str = "kroki") -> Path: builder = self.app.builder output_format = self.output_format(node) diagram_type = node["type"] diagram_source = node["source"] diagram_options = node["options"] if "options" in node else {} try:
> out = render_kroki( builder, diagram_type, diagram_source, output_format, diagram_options, prefix, )../../BUILDROOT/python-sphinxcontrib-kroki-1.3.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/kroki/transform.py:44:_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _builder = <sphinx.builders.html.StandaloneHTMLBuilder object at 0x7f4400c59d90>, diagram_type = 'mermaid', diagram_source = 'graph TD\n A[ Anyone ]', output_format = 'svg'diagram_options = {}, prefix = 'kroki' def render_kroki( builder: Builder, diagram_type: str, diagram_source: str, output_format: str, diagram_options: Dict[str, Any] = {}, prefix: str = "kroki", ) -> Path: kroki_url: str = builder.config.kroki_url payload: Dict[str, Union[str, Dict]] = { "diagram_source": diagram_source, "diagram_type": diagram_type, "diagram_options": diagram_options, "output_format": output_format, } hashkey = (str(kroki_url) + str(payload)).encode() fname = "%s-%s.%s" % (prefix, sha1(hashkey).hexdigest(), output_format) outfn = Path(builder.outdir).joinpath(builder.imagedir, fname) if outfn.is_file(): return outfn try: outfn.parent.mkdir(parents=True, exist_ok=True) response = requests.post(kroki_url, json=payload, stream=True) response.raise_for_status() with outfn.open(mode="wb") as f: for chunk in response.iter_content(chunk_size=128): f.write(chunk) return outfn except requests.exceptions.RequestException as e:
> raise KrokiError(__("kroki did not produce a diagram")) from eE sphinxcontrib.kroki.kroki.KrokiError: kroki did not produce a diagram../../BUILDROOT/python-sphinxcontrib-kroki-1.3.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/kroki/kroki.py:276: KrokiErrorThe above exception was the direct cause of the following exception:app = <SphinxTestApp buildername='html'>, status = <_io.StringIO object at 0x7f4401baf3a0>, warning = <_io.StringIO object at 0x7f4401baf430> @pytest.mark.sphinx( "html", testroot="kroki", confoverrides={"master_doc": "index"} ) def test_kroki_html(app, status, warning):
> content = get_content(app)tests/test_kroki.py:24:_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _tests/test_kroki.py:14: in get_content app.builder.build_all()/usr/lib/python3.8/site-packages/sphinx/builders/__init__.py:265: in build_all self.build(None, summary=__('all source files'), method='all')/usr/lib/python3.8/site-packages/sphinx/builders/__init__.py:317: in build updated_docnames = set(self.read())/usr/lib/python3.8/site-packages/sphinx/builders/__init__.py:424: in read self._read_serial(docnames)/usr/lib/python3.8/site-packages/sphinx/builders/__init__.py:445: in _read_serial self.read_doc(docname)/usr/lib/python3.8/site-packages/sphinx/builders/__init__.py:498: in read_doc publisher.publish()/usr/lib/python3.8/site-packages/docutils/core.py:219: in publish self.apply_transforms()/usr/lib/python3.8/site-packages/docutils/core.py:200: in apply_transforms self.document.transformer.apply_transforms()/usr/lib/python3.8/site-packages/sphinx/transforms/__init__.py:80: in apply_transforms super().apply_transforms()/usr/lib/python3.8/site-packages/docutils/transforms/__init__.py:171: in apply_transforms transform.apply(**kwargs)../../BUILDROOT/python-sphinxcontrib-kroki-1.3.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/kroki/transform.py:26: in apply out = self.render(node)_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _self = <sphinxcontrib.kroki.transform.KrokiToImageTransform object at 0x7f4400c5ff10>, node = <kroki: >, prefix = 'kroki' def render(self, node: kroki, prefix: str = "kroki") -> Path: builder = self.app.builder output_format = self.output_format(node) diagram_type = node["type"] diagram_source = node["source"] diagram_options = node["options"] if "options" in node else {} try: out = render_kroki( builder, diagram_type, diagram_source, output_format, diagram_options, prefix, ) except KrokiError as exc: logger.warning( __("kroki %s diagram (%s) with source %r: %s"), diagram_type, output_format, diagram_source, exc, )
> raise SkipNode from excE docutils.nodes.SkipNode../../BUILDROOT/python-sphinxcontrib-kroki-1.3.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/kroki/transform.py:60: SkipNode------------------------------------------------------------------------- Captured stdout teardown -------------------------------------------------------------------------
# testroot: root
# builder: html
# srcdir: /tmp/pytest-of-tkloczko/pytest-913/kroki
# outdir: /tmp/pytest-of-tkloczko/pytest-913/kroki/_build/html
# status:Running Sphinx v5.1.1building [html]: all source filesupdating environment: [new config] 1 added, 0 changed, 0 removedreading sources... [100%] index
# warning:WARNING: kroki mermaid diagram (svg) with source 'graph TD\n A[ Anyone ]': kroki did not produce a diagram============================================================================= warnings summary =============================================================================tests/test_kroki.py::test_kroki_html /home/tkloczko/rpmbuild/BUILDROOT/python-sphinxcontrib-kroki-1.3.0-2.fc35.x86_64/usr/lib/python3.8/site-packages/sphinxcontrib/kroki/transform.py:17: PendingDeprecationWarning: nodes.Node.traverse() is obsoleted by Node.findall(). for node in self.document.traverse(kroki):-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html========================================================================= short test summary info ==========================================================================FAILED tests/test_kroki.py::test_kroki_html - docutils.nodes.SkipNode======================================================================= 1 failed, 1 warning in 0.91s =======================================================================
I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.
python3 -sBm build -w --no-isolation
build
with--no-isolation
I'm using during all processes only locally installed modulesHere is pytest output:
Here is list of modules installed in build env:
The text was updated successfully, but these errors were encountered: