-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Latex drawer tested using notebook in binder #6450
Latex drawer tested using notebook in binder #6450
Conversation
@@ -3,35 +3,61 @@ | |||
{ | |||
"cell_type": "code", | |||
"execution_count": null, | |||
"id": "fc250437", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is possible to "clean" the notebook with nb-clean
. In this way, we can keep the minimum file in the repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, sure. I'll do that 😃
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work.
For a following PR, would be possible to have a py
version of snapshot_tester.ipynb
? With #6427 , CI could run snapshot_tester.py
. What do you think?
new tests where necessary. You can do this as follows: | ||
|
||
1. Make sure you have pushed your latest changes to your remote branch. | ||
2. Go to link: `https://mybinder.org/v2/gh/<github_user>/<repo>/<branch>?urlpath=apps/test/ipynb/mpl_tester.ipynb`. For example, if your GitHub username is `username`, your forked repo has the same name the original, and your branch is `my_awesome_new_feature`, you should visit https://mybinder.org/v2/gh/username/qiskit-terra/my_awesome_new_feature?urlpath=apps/test/ipynb/mpl_tester.ipynb. | ||
2. Go to link: `https://mybinder.org/v2/gh/<github_user>/<repo>/<branch>?urlpath=apps/test/ipynb/snapshot_tester.ipynb`. For example, if your GitHub username is `username`, your forked repo has the same name the original, and your branch is `my_awesome_new_feature`, you should visit https://mybinder.org/v2/gh/username/qiskit-terra/my_awesome_new_feature?urlpath=apps/test/ipynb/snapshot_tester.ipynb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not able to run https://mybinder.org/v2/gh/TharrmashasthaPV/qiskit-terra/binder_test_branch?filepath=apps/test/ipynb/snapshot_tester.ipynb . Maybe binder is in a bad day? Maybe I'm doing something wrong?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be a small error in the link you tried. 😃 We use either ...filepath=test/ipynb/snapshot_tester.py
or ...urlpath=apps/test/ipynb/snapshot_tester.py
in the link. One correct link is https://mybinder.org/v2/gh/TharrmashasthaPV/qiskit-terra/binder_test_branch?urlpath=apps/test/ipynb/snapshot_tester.ipynb. This link seems to be working for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also was struggling to run them a few days ago. I did manage to run them in the end but they were very slow. Also wasn't sure if it was a binder issue, or maybe something to do with the changes here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just tested running branches with and without the change of this PR and I kind of found them both to take similar duration (around 3 mins) to open a server for the first time a branch is run after a commit. So, I think it is a binder issue.
Thanks! I think currently we are just saving the output images at |
…aPV/qiskit-terra into binder_test_branch
…nder_test_branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks Tharrma! 🚀
postBuild
Outdated
@@ -11,6 +11,10 @@ | |||
pip install matplotlib pylatexenc pillow appmode seaborn | |||
pip install . | |||
|
|||
# Install QCircuit for LaTeX drawer | |||
mkdir -p $(kpsewhich -var-value=TEXMFHOME)/tex/latex/qcircuit/ | |||
wget https://mirrors.ctan.org/graphics/qcircuit/qcircuit.sty -P $(kpsewhich -var-value=TEXMFHOME)/tex/latex/qcircuit/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wget https://mirrors.ctan.org/graphics/qcircuit/qcircuit.sty -P $(kpsewhich -var-value=TEXMFHOME)/tex/latex/qcircuit/ | |
tlmgr install qcircuit |
@@ -10,7 +10,7 @@ | |||
# copyright notice, and modified files need to carry a notice indicating | |||
# that they have been altered from the originals. | |||
|
|||
"""Image comparison test for MPL graph drawer. | |||
"""Image comparison test for MPL drawer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"""Image comparison test for MPL drawer. | |
"""Image comparison test for MPL circuit drawer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think just MPL drawer
is correct, as it tests both the graphs and the circuits, then each subfolder has it's own __init.py__
where it specifies if it's testing the graphs or circuits
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case...
"""Image comparison test for MPL drawer. | |
"""Image comparison test for MPL drawers. |
Pull Request Test Coverage Report for Build 1493871580
💛 - Coveralls |
In principle, despite its age, this PR still looks mostly appropriate to me, and not too far off merging. I suspect that the conflicts are mostly a minor change in this PR conflicting with another minor styling change in the LaTeX output since this PR was opened. @1ucian0 - you assigned yourself before. Can you finish off driving this over the line? If you write the small changes you think were required, I can do the final review. |
This can probably be closed as we are moving to CI visual testing in #9961 |
Summary
Fixes #6371 .
Details and comments
Following #4544 , this PR enable testing Latex drawer using notebook in Binder. The flow of the testing follows exactly from #4544 . The binder of this PR can be accessed at https://mybinder.org/v2/gh/TharrmashasthaPV/qiskit-terra/binder_test_branch?filepath=test%2Fipynb%2Flatex_tester.ipynb. The release notes have been added.
Files added/modified
test/ipynb/mpl_tester.ipynb
totest/iplynb/snapshot_tester.ipynb
- The notebook that will run in Binder that includes tests for both mpl and latex drawers.apt.txt
- This file installs the required latex dependencies.postBuild
- This file now also collect and installs the latex qcircuit.sty package.test/ipynb/latex/references
- This folder contains all the reference images.test/ipynb/latex/test_circuit_latex_drawer.py
- The file that contains all the latex tests.