sphinxcontrib-phpdomain
sphinxcontrib-phpdomain copied to clipboard
running tests fails on `test_doc2`
While trying to run your tests on debian they actually fail.
make -C test/unit clean
make -C test/unit html SPHINXOPTS='-W'
make -C test/unit comparehtml
There is this diff
diff -u test_doc2.html _build/html/test_doc2.html.result
--- test_doc2.html 2025-02-04 08:16:51.650738678 +0000
+++ _build/html/test_doc2.html.result 2025-02-04 08:41:55.097599485 +0000
@@ -95,14 +95,17 @@
</dd>
</dl>
<dl class="php class">
- <dt class="sig sig-object php" id="LibraryName\Foo\Data\Thing">
+ <dt class="sig sig-object php" id="LibraryName\\Foo\Data\Thing">
<em class="property">
<span class="pre">class</span>
</em>
+ <span class="sig-prename descclassname">
+ <span class="pre">LibraryName\</span>
+ </span>
<span class="sig-name descname">
- <span class="pre">Foo\Data\Thing</span>
+ <span class="pre">\Foo\Data\Thing</span>
</span>
- <a class="headerlink" href="#LibraryName\Foo\Data\Thing" title="Link to this definition">¶</a>
+ <a class="headerlink" href="#LibraryName\\Foo\Data\Thing" title="Link to this definition">¶</a>
</dt>
<dd>
<p>A class is with an absolute namespace.</p>
@@ -127,11 +130,9 @@
<span class="pre">LibraryName\ThirdClass</span>
</code>
</a>
- <a class="reference internal" href="#LibraryName\Foo\Data\Thing" title="LibraryName\Foo\Data\Thing">
- <code class="xref php php-class docutils literal notranslate">
- <span class="pre">Foo\Data\Thing</span>
- </code>
- </a>
+ <code class="xref php php-class docutils literal notranslate">
+ <span class="pre">Foo\Data\Thing</span>
+ </code>
</p>
</section>
</section>
~~The cause might be in any of the python3 dep actually.~~
Actually, the tests were running with the version installed on the system (0.11.2) instead of the version I just built which wasn't installed yet.
I don't know how this could be improved.
Invoking with PYTHONPATH=$PWD make -C test/unit html SPHINXOPTS='-W' makes it work.
One way would probably be to modify this line to include the parent directory, this should allow to skip the pip install . on the CI (not run in Debian anyways), but still beeing able to load the phpdomain extension:
https://github.com/markstory/sphinxcontrib-phpdomain/blob/b704e8ec70f1863de491bf7e75161023e87e3dfa/test/unit/conf.py#L19
(I'll test as soon as I can)
OK, the only way I managed to make it work was by using this patch:
$ git diff
diff --git a/test/unit/conf.py b/test/unit/conf.py
index 2a4b5d9..f5dcbcd 100644
--- a/test/unit/conf.py
+++ b/test/unit/conf.py
@@ -16,7 +16,7 @@ import sys, os
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
-sys.path.append(os.path.abspath(".."))
+sys.path.insert(0, os.path.abspath("../../sphinxcontrib"))
# -- General configuration -----------------------------------------------------
@@ -25,7 +25,7 @@ needs_sphinx = "1.0"
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
-extensions = ["sphinxcontrib.phpdomain"]
+extensions = ["phpdomain"]
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
The insert on itself was not enough, for some reason, python continued to look for sphinxcontrib.* modules in my virtualenv. so I resorted to manually add the sphinxcontrib directory to the path and only require phpdomain instead of sphinxcontrib.phpdomain. This allows to skip the pip install . step to run the tests.