Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

FIX nose.tools.assert_is is only supported with python2.7 #1162

Merged
merged 1 commit into from

3 participants

@NelleV
Collaborator

assert_is is only supported in python2.7.

I've got other tests failing on my box, but I don't know how to fix them: http://bpaste.net/show/unemAaLZCxFixslh2FBi/

Thanks,
Nelle

@pelson pelson commented on the diff
lib/matplotlib/tests/test_figure.py
((24 lines not shown))
ax2 = fig.add_subplot(121, projection='polar')
- assert_is(fig.gca(), ax2)
- assert_is(fig.gca(polar=True), ax2)
-
+ assert_true(fig.gca() is ax2)
+ assert_true(fig.gca(polar=True)is ax2)
@pelson Collaborator
pelson added a note

seems to be a space missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@pelson
Collaborator

Looks good to me. I'm quite surprised that this is a python version issue and not a nose version issue. Did you find this stated explicitly somewhere?

@pelson
Collaborator

The other problems should ideally be raised in another issue. (with the image differences, did you check the two versions and see the differences?)

@NelleV
Collaborator

Nose only provides a warper around unittest that makes the assert* method pep8 compatible. assertIs was introduced in the standard library's unittest only for python2.7. Hence, nose doesn't expose assert_is for python2.5 and python2.6.

I've asked a bit if there were buildbots or jenkins running for matplotlib. If not, I can maybe try to set one up with python2.5 on the french python association server. Else, shiningpanda provides a jenkin installation for free for opensource softwares. That would allow to pick up on those non trivial and annoying problems :)

For the differences in the images, it looked to me like a font rendering problem. I can investigate the issues and open a bug report.

@pelson
Collaborator

note: Deleted posts from @NelleV which were intended for another PR.

@mdboom
Owner

@NelleV: I python2.6 buildbot would be helpful, but matplotlib no longer officially supports python2.5 as of the 1.2 release (because it's so difficult to write 2/3 compatible code and support 2.5).

I have investigated shiningpanda and the past. Unfortunately, the runtimes of the matplotlib unit tests are so large that we use 3 times the daily CPU unit for a free project in a single test run, so it's kind of a no go. There is some Travis support in matplotlib now, but I haven't had a chance to really dig down into what it gives us yet.

As for the font difference, it may be that the test needs to be limited to a particular range of freetype versions, as some of our tests already do.

@NelleV
Collaborator

@mdboom Should I have a look at how to set this up ? I can have the build run every half an hour or every hour (that depends on the load of the server) if I have the permission of the AFPy.

It seems sane to me not support python2.5 anymore :)

@mdboom
Owner

I'm in the process of getting the Travis set up now -- that should test multiple versions of Python. Assuming this works, we may not need to take you up on your generous offer. It probably wouldn't hurt to have our own Travis instances running in various places, though.

@pelson pelson merged commit 3649d2b into matplotlib:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 28, 2012
  1. @NelleV
This page is out of date. Refresh to see the latest.
Showing with 22 additions and 18 deletions.
  1. +22 −18 lib/matplotlib/tests/test_figure.py
View
40 lib/matplotlib/tests/test_figure.py
@@ -1,11 +1,12 @@
-from nose.tools import assert_equal, assert_is, assert_is_not
+from nose.tools import assert_equal, assert_true
from matplotlib.testing.decorators import image_comparison, cleanup
import matplotlib.pyplot as plt
@cleanup
def test_figure_label():
- # pyplot figure creation, selection and closing with figure label and number
+ # pyplot figure creation, selection and closing with figure label and
+ # number
plt.close('all')
plt.figure('today')
plt.figure(3)
@@ -33,34 +34,37 @@ def test_figure():
ax.plot(range(5))
# plot red line in a different figure.
plt.figure('tomorrow')
- plt.plot([0, 1], [1,0], 'r')
+ plt.plot([0, 1], [1, 0], 'r')
# Return to the original; make sure the red line is not there.
plt.figure('today')
plt.close('tomorrow')
-
-
+
+
@cleanup
def test_gca():
fig = plt.figure()
ax1 = fig.add_axes([0, 0, 1, 1])
- assert_is(fig.gca(projection='rectilinear'), ax1)
- assert_is(fig.gca(), ax1)
-
+ assert_true(fig.gca(projection='rectilinear') is ax1)
+ assert_true(fig.gca() is ax1)
+
ax2 = fig.add_subplot(121, projection='polar')
- assert_is(fig.gca(), ax2)
- assert_is(fig.gca(polar=True), ax2)
-
+ assert_true(fig.gca() is ax2)
+ assert_true(fig.gca(polar=True)is ax2)
@pelson Collaborator
pelson added a note

seems to be a space missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
ax3 = fig.add_subplot(122)
- assert_is(fig.gca(), ax3)
+ assert_true(fig.gca() is ax3)
# the final request for a polar axes will end up creating one
# with a spec of 111.
- assert_is_not(fig.gca(polar=True), ax3)
- assert_is_not(fig.gca(polar=True), ax2)
+ assert_true(fig.gca(polar=True) is not ax3)
+ assert_true(fig.gca(polar=True) is not ax2)
assert_equal(fig.gca().get_geometry(), (1, 1, 1))
-
+
fig.sca(ax1)
- assert_is(fig.gca(projection='rectilinear'), ax1)
- assert_is(fig.gca(), ax1)
-
+ assert_true(fig.gca(projection='rectilinear') is ax1)
+ assert_true(fig.gca() is ax1)
+
+if __name__ == "__main__":
+ import nose
+ nose.runmodule(argv=['-s', '--with-doctest'], exit=False)
Something went wrong with that request. Please try again.