question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failing test on local environment

See original GitHub issue

I’m seeing a number of tests failing locally and I can’t figure out why. Visually, the PDFs in rst2pdf/tests/output and rst2pdf/tests/reference look very similar.

  • test_fancytitles.txt
  • test_foreground.txt
  • test_image_units_pdf.txt
  • test_issue_263.txt
  • test_issue_266_3.txt
  • test_issue_266_4.txt
  • test_issue_267.txt
  • test_issue_294.txt
  • test_issue_311.txt
  • test_issue_383.txt
  • test_vectorpdf.txt

The only common theme I see here is that the vectorpdf extension is used in many, though not all (I don’t think fancytitles uses it) of them. I’m using my tox environment for this, so things are isolated, and I see the exact same failures with a virtualenv. I’m also running Fedora 29, but I have the exact same issues with an Ubuntu 16.04 VM. Any suggestions on where/how I can start investigating the issue?

$ pip freeze
aafigure==0.6
alabaster==0.7.12
attrs==19.1.0
Babel==2.7.0
backports.functools-lru-cache==1.5
certifi==2019.6.16
chardet==3.0.4
coverage==4.5.4
cssselect2==0.2.1
cycler==0.10.0
docutils==0.15.2
html5lib==1.0.1
idna==2.8
imagesize==1.1.0
Jinja2==2.10.1
kiwisolver==1.1.0
lxml==4.4.1
MarkupSafe==1.1.1
matplotlib==2.2.4
nose==1.3.7
numpy==1.16.4
packaging==19.1
pdfrw==0.4
Pillow==6.1.0
Pygments==2.4.2
pyparsing==2.4.2
PyPDF2==1.26.0
python-dateutil==2.8.0
pytz==2019.2
reportlab==3.5.23
requests==2.22.0
-e git+https://github.com/rst2pdf/rst2pdf@5223553be12428955bad5ee6b1aa09b353a672a1#egg=rst2pdf
six==1.12.0
smartypants==2.0.1
snowballstemmer==1.9.0
Sphinx==1.8.5
sphinxcontrib-websupport==1.1.2
subprocess32==3.5.4
svglib==0.9.2
tinycss2==0.6.1
typing==3.7.4
urllib3==1.25.3
webencodings==0.5.1
xhtml2pdf==0.2.3

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
stephenfincommented, Jun 6, 2020

At least on my Fedora 31 host, most of these issues have been resolved by the move to content-based comparison in #854 and the remaining failures are addressed by #869. We can close this now 🙌

0reactions
stephenfincommented, Aug 19, 2019

Okay, resolved a few of them by installing svglib (pip install svglib) along with some texlive binary dependencies (sudo dnf install texlive-ucs texlive-anyfontsize texlive-amscls). Alas, I still see three failing tests:

  • test_fancytitles.txt
  • test_issue_311.txt
  • sphinx-issue252

I’m still investigating the first of these but the second looks like it would never pass. If I diff the reference and output I see:

$ diff -u rst2pdf/tests/reference/test_issue_311.pdf rst2pdf/tests/output/test_issue_311.pdf                           
--- /home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/reference/test_issue_311.pdf    2019-07-16 11:23:07.474116339 +0100                                                                                
+++ /home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/output/test_issue_311.pdf       2019-08-19 17:19:59.053138092 +0100                                                                                
@@ -13,7 +13,7 @@                                                                                                                                                                                                  
 3 0 obj                                                                                                                                                                                                           
 <<                                                                                                                                                                                                                
 /A <<                                                                                                                                                                                                             
-/S /URI /Type /Action /URI (file:///Users/rob/Projects/python/rst2pdf/rst2pdf/tests/input/images/biohazard.pdf)                                                                                                   
+/S /URI /Type /Action /URI (file:///home/sfinucan/Development/rst2pdf/rst2pdf/tests/input/images/biohazard.pdf)                                                                                        
 >> /Border [ 0 0 0 ] /Rect [ 101.5929 753.0236 116.5929 765.0236 ] /Subtype /Link /Type /Annot                                                                                                                    
 >>                                                                                                                                                                                                                
 endobj                                                                                                                                                                                                            

(this is partial - there are more diffs but this is the first and most obvious one).

The third one is trickier. I see this:

Process "make" started on Mon Aug 19 17:42:47 2019                                                                                                                                                                 
...
  writing MyProject...                                                                                                                                                                                             
* [WARNING] basenodehandler.py:166 Unkn. node (self.textdispatch): sphinx.ext.mathbase.math [near line UNKNOWN in file UNKNOWN]                                                                                    
* [WARNING] basenodehandler.py:166 Unkn. node (self.elemdispatch): sphinx.ext.mathbase.displaymath [near line 13 in file /home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/input/sphinx-issue252/index.rs
t]                                                                                                                                                                                                                 
* [ERROR] pdfbuilder.py:144 format not resolved, probably missing URL scheme or undefined destination target for 'equation-euler'
* Traceback (most recent call last):
*   File "/home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/env/lib/python2.7/site-packages/rst2pdf/pdfbuilder.py", line 141, in write
*     docwriter.write(doctree, destination)
*   File "/home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/env/lib/python2.7/site-packages/docutils/writers/__init__.py", line 80, in write
*     self.translate()
*   File "/home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/env/lib/python2.7/site-packages/rst2pdf/pdfbuilder.py", line 635, in translate
*     compressed=self.compressed)
*   File "/home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/env/lib/python2.7/site-packages/rst2pdf/createpdf.py", line 641, in createPdf
*     pdfdoc.multiBuild(elements)
*   File "/home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/env/lib/python2.7/site-packages/reportlab/platypus/doctemplate.py", line 1133, in multiBuild
*     self.canv.save()
*   File "/home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/env/lib/python2.7/site-packages/reportlab/pdfgen/canvas.py", line 1240, in save
*     self._doc.SaveToFile(self._filename, self)
*   File "/home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/env/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 215, in SaveToFile
*     data = self.GetPDFData(canvas)
*   File "/home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/env/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 241, in GetPDFData
*     return self.format()
*   File "/home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/env/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 418, in format
*     IOf = IO.format(self)
*   File "/home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/env/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 866, in format
*     fcontent = format(self.content, document, toplevel=1)   # yes this is at top level
*   File "/home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/env/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 80, in format
*     f = element.format(document)
*   File "/home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/env/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 1602, in format
*     return D.format(document)
*   File "/home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/env/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 674, in format
*     L = [(format(PDFName(k),document)+b" "+format(dict[k],document)) for k in keys]
*   File "/home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/env/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 80, in format
*     f = element.format(document)
*   File "/home/sfinucan/Development/innovation/rst2pdf/rst2pdf/tests/env/lib/python2.7/site-packages/reportlab/pdfbase/pdfdoc.py", line 1767, in format
*     if f is None: raise ValueError("format not resolved, probably missing URL scheme or undefined destination target for '%s'" % self.name)
* ValueError: format not resolved, probably missing URL scheme or undefined destination target for 'equation-euler'
  FAILED
  build succeeded.
   
  Build finished. The PDF files are in _build/pdf.

I have no idea how to resolve this 😞

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why would my code tests pass successfully in development ...
The best solution is to generally try to recreate your prod environment in a staging pool. Your staging pool should usually be as...
Read more >
How to Fix Flaky Tests - Semaphore CI
Randomly failing tests are the hardest to debug. Here's a framework you can use to fix them and keep your test suite healthy....
Read more >
Debugging Failing Tests and Test Pipelines - GitLab
Tips for running tests locally. Use the environment variable QA_LOG_LEVEL=debug to enable additional logging output that includes page actions and Git commands.
Read more >
Troubleshooting Continuous Integration, or How to Debug ...
Troubleshooting Continuous Integration, or How to Debug Tests That Fail on CI, but Pass Locally · Don't Relaunch the CI Build · Rebase...
Read more >
Why tests pass locally but fail in Jenkins | Object Partners
Why your tests may pass locally but fail in Jenkins · The first thing you want to do is determine the source(s) of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found