Skip to content
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

PGF backend, fix #1116, #1118 and #1128 #1124

Merged
merged 6 commits into from Aug 22, 2012
Merged

PGF backend, fix #1116, #1118 and #1128 #1124

merged 6 commits into from Aug 22, 2012

Conversation

pwuertz
Copy link
Contributor

@pwuertz pwuertz commented Aug 21, 2012

This PR contains the fixes for #1116, #1118 and #1128.

@mdboom
Copy link
Member

mdboom commented Aug 22, 2012

On a machine that still has the "too old" TeX, I now get this, which is correct -- they are known failures (and I've turned off the KnownFailure class here just so I can see exactly where they are coming from).

>nosetests-2.7 matplotlib.tests.test_backend_pgf
/home/mdboom/python/lib/python2.7/site-packages/matplotlib/__init__.py:768: UserWarning: Bad val "True" on line #12
        "text.hinting: True
"
        in file "/home/mdboom/.matplotlib/matplotlibrc"
        hinting should be 'auto', 'native', 'either' or 'none'
  "%s"\n\t%s' % (val, cnt, line, fname, msg))
EEE
======================================================================
ERROR: matplotlib.tests.test_backend_pgf.test_xelatex
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mdboom/python/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/mdboom/python/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 47, in failer
    raise KnownFailureTest(msg) # An error here when running nose means that you don't have the matplotlib.testing.noseclasses:KnownFailure plugin in use.
KnownFailureTest: xelatex + pgf is required

======================================================================
ERROR: matplotlib.tests.test_backend_pgf.test_pdflatex
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mdboom/python/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/mdboom/python/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 51, in failer
    raise KnownFailureDidNotFailTest(msg)
KnownFailureDidNotFailTest: pdflatex + pgf is required

======================================================================
ERROR: matplotlib.tests.test_backend_pgf.test_rcupdate
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mdboom/python/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/mdboom/python/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 47, in failer
    raise KnownFailureTest(msg) # An error here when running nose means that you don't have the matplotlib.testing.noseclasses:KnownFailure plugin in use.
KnownFailureTest: xelatex and pdflatex + pgf required

----------------------------------------------------------------------
Ran 3 tests in 5.867s

However, on a machine where I upgraded the TeX to TeXLive 2012, I'm getting this:


.FF
======================================================================
FAIL: matplotlib.tests.test_backend_pgf.test_pdflatex
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mdboom/python/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/mdboom/python/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 39, in failer
    result = f(*args, **kwargs)
  File "/home/mdboom/python/lib/python2.7/site-packages/matplotlib/tests/test_backend_pgf.py", line 39, in backend_switcher
    result = func(*args, **kwargs)
  File "/home/mdboom/python/lib/python2.7/site-packages/matplotlib/tests/test_backend_pgf.py", line 91, in test_pdflatex
    compare_figure('pgf_pdflatex.pdf')
  File "/home/mdboom/python/lib/python2.7/site-packages/matplotlib/tests/test_backend_pgf.py", line 55, in compare_figure
    raise ImageComparisonFailure('images not close: %s vs. %s' % (actual, expected))
ImageComparisonFailure: images not close: /home/mdboom/Work/tmp/matplotlib/tests/result_images/test_backend_pgf/pgf_pdflatex.pdf vs. /home/mdboom/Work/tmp/matplotlib/tests/result_images/test_backend_
pgf/expected_pgf_pdflatex.pdf

======================================================================
FAIL: matplotlib.tests.test_backend_pgf.test_rcupdate
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/mdboom/python/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/mdboom/python/lib/python2.7/site-packages/matplotlib/testing/decorators.py", line 39, in failer
    result = f(*args, **kwargs)
  File "/home/mdboom/python/lib/python2.7/site-packages/matplotlib/tests/test_backend_pgf.py", line 39, in backend_switcher
    result = func(*args, **kwargs)
  File "/home/mdboom/python/lib/python2.7/site-packages/matplotlib/tests/test_backend_pgf.py", line 119, in test_rcupdate
    compare_figure('pgf_rcupdate%d.pdf' % (i+1))
  File "/home/mdboom/python/lib/python2.7/site-packages/matplotlib/tests/test_backend_pgf.py", line 55, in compare_figure
    raise ImageComparisonFailure('images not close: %s vs. %s' % (actual, expected))
ImageComparisonFailure: images not close: /home/mdboom/Work/tmp/matplotlib/tests/result_images/test_backend_pgf/pgf_rcupdate2.pdf vs. /home/mdboom/Work/tmp/matplotlib/tests/result_images/test_backend
_pgf/expected_pgf_rcupdate2.pdf

----------------------------------------------------------------------
Ran 3 tests in 4.909s

I've put my PDF files up here:

http://mdboom.github.com/scraps/pgf_pdflatex.pdf

http://mdboom.github.com/scraps/pgf_rcparams2.pdf

As for the Python 3 stuff, I plan to tackle #983 today, and that should hopefully get the python 3 tests running for you.

@pwuertz
Copy link
Contributor Author

pwuertz commented Aug 22, 2012

Downloading pgf_rcparams2.pdf doesn't work for me, but from the pgf_pdflatex.pdf you uploaded I get that the default fonts of our latex environments are slightly different. The difference is very minimal and shouldn't cause the test to fail. When I wrote the tests I lowered the default tolerance of 1e-3 to 1e-4 because the test didn't recognize when I changed the fonts from serif to sans. Seems that tol=1e-4 is too restrictive. I reverted the tolerance back to 1e-3. Does this work for you?

@pwuertz
Copy link
Contributor Author

pwuertz commented Aug 22, 2012

Oh.. and that knownfailureif-decorator confuses me.. for some reason, the pdflatex test actually worked with your old tex distribution.. and the test raised a KnownFailureDidNotFailTest exception. What I'm actually looking for is a decorator that doesn't try to verify if the test really fails and blames me if it succeeds :).

@mdboom
Copy link
Member

mdboom commented Aug 22, 2012

If I change the tolerance to 5e-3, it works for me.

@pwuertz
Copy link
Contributor Author

pwuertz commented Aug 22, 2012

So tol=1e-3 didn't work for you neither? I'm using 5e-3 now. Furthermore, I discovered SkipTest in nose.plugins.skip which does exactly what I wanted. It doesn't require that a test that is marked as known-to-fail actually fails.

@pwuertz
Copy link
Contributor Author

pwuertz commented Aug 22, 2012

Ahh ok.. I now see whats the big difference between those images.. Its just ghostscript being horrible at rendering text for some (many) fonts. I checked the PDFs using the gnome viewer and gimp (both cairo based) and saw no difference. The gs converted PNG files both look horrible but in a different way.

@mdboom
Copy link
Member

mdboom commented Aug 22, 2012

I first tried a tol of 1e-3, but that was still too strict. 5e-3 was the lowest I could go to get the tests to pass.

That's a bummer about gs -- we could probably move to another renderer down the road, but not for this release. I think we just raise the tolerance for now.

@pwuertz
Copy link
Contributor Author

pwuertz commented Aug 22, 2012

I finished running the tests using python3. Some additional ResourceWarning messages are emitted when using py3. I got rid of the ones being traced back to backend_pgf.py. These remain:

/usr/lib/python3.2/subprocess.py:650: ResourceWarning: unclosed file <_io.FileIO name=11 mode='rb'>

Nothing to be concerned about though. I think these fixes are good to go.

@mdboom
Copy link
Member

mdboom commented Aug 22, 2012

Thanks for working through this so quickly!

mdboom added a commit that referenced this pull request Aug 22, 2012
@mdboom mdboom merged commit c981774 into matplotlib:master Aug 22, 2012
physinet added a commit to physinet/matplotlib that referenced this pull request Oct 31, 2018
Commit 86ac6ce undid the changes from commit d527799 to change the behavior of shift-enter in Jupyter notebook, as discussed in matplotlib#1124, matplotlib#4758, and matplotlib#6752.

With the changes here, shift-enter now selects the next cell, executes it, and then selects the following cell.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants