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.

Pass Manager Visualization Tests fail locally

See original GitHub issue

Information

  • Qiskit Terra version: Master
  • Python version: 3.7
  • Operating system: Linux
  • dot - graphviz version 2.40.1 (0)

What is the current behavior?

When running the terra unit tests locally from a fresh master with no local modification the image comparison in the pass manager visualization tests fail for me locally. Either we need to relax the comparison threshold or make the image drawing deterministic

test.python.visualization.test_pass_manager_drawer.TestPassManagerDrawer.test_pass_manager_drawer_basic
-------------------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    b'Traceback (most recent call last):'
    b'  File "/home/computertreker/git/qiskit/qiskit-core/test/python/visualization/test_pass_manager_drawer.py", line 52, in test_pass_manager_drawer_basic'
    b"    self.assertImagesAreEqual(filename, path_to_diagram_reference('pass_manager_l0_ref.png'))"
    b'  File "/home/computertreker/git/qiskit/qiskit-core/test/python/visualization/visualization.py", line 62, in assertImagesAreEqual'
    b'    .format(diff_tolerance * 100))'
    b'  File "/usr/lib64/python3.7/unittest/case.py", line 692, in assertTrue'
    b'    raise self.failureException(msg)'
    b'AssertionError: False is not true : The images are different by more than a 0.1%'
    b''

test.python.visualization.test_pass_manager_drawer.TestPassManagerDrawer.test_pass_manager_drawer_style
-------------------------------------------------------------------------------------------------------

Captured traceback:
~~~~~~~~~~~~~~~~~~~
    b'Traceback (most recent call last):'
    b'  File "/home/computertreker/git/qiskit/qiskit-core/test/python/visualization/test_pass_manager_drawer.py", line 69, in test_pass_manager_drawer_style'
    b"    path_to_diagram_reference('pass_manager_l1_style_ref.png'))"
    b'  File "/home/computertreker/git/qiskit/qiskit-core/test/python/visualization/visualization.py", line 62, in assertImagesAreEqual'
    b'    .format(diff_tolerance * 100))'
    b'  File "/usr/lib64/python3.7/unittest/case.py", line 692, in assertTrue'
    b'    raise self.failureException(msg)'
    b'AssertionError: False is not true : The images are different by more than a 0.1%'
    b''

Steps to reproduce the problem

Run unit tests with graphviz installed

What is the expected behavior?

The tests pass

Suggested solutions

Either we need to relax the comparison threshold or make the image drawing deterministic

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
kdkcommented, May 31, 2019

What about dumping the pydot graph to DOT and asserting based on that? We can still verify that we are building the graph correctly, and leave pydot to draw the graph consistently. It should be more robust to changes in environment (and would be diffable!)

0reactions
1ucian0commented, May 30, 2019

Fonts might vary a lot in each platform. Ideally, we should try to find the same font for every platform, but it might not be possible. We should consider alternatives if that’s a dead-end.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
What To Do When Tests Fail? - TestProject
Test failures - how they impact our app quality, how to prevent them, what best practices exists to detect them ealy and fix...
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 >
Why did my test fail? - Testim overview
A defect was identified in the tested application and the test did not return the expected results. There was a flaw in the...
Read more >
Flaky tests - GitLab Docs
It's a test that sometimes fails, but if you retry it enough times, it passes, eventually. What are the potential cause for a...
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