Tests pass on Mac, not on Windows

I am doing my tests using:
loadPrcFileData("", “window-type offscreen”)

On the Windows machine, I get this warning for each of my tests:

Known pipe types:
(all display modules loaded)
:display(warning): FrameBufferProperties available less than requested.

Then, the first test loads and passes, but all subsequent tests fail with the StandardError:
Attempt to spawn multiple ShowBase instances!

On the Mac, I do not get a warning:
Known pipe types:
(all display modules loaded.)
And the tests all pass.

My teardown is
del self.w
where self.w is my World()
and self.w.close(), for the purpose of tests does self.ignoreAll()

Are these two things related? Or is something else going on? Any ideas?

On the Windows (Windows 7) machine, we are running:
Python 2.7.3, installed by Panda3d, and located in the Panda3d folder
Panda3d 1.8.1 located in c:\Panda3D-1.8.1

On the Mac (OS 10.8.5), we are running:
Python 2.7.2 system python
Panda3d 1.8.1 is installed in /Developer/Panda3d


This warning:

means that Panda3D requested a framebuffer configuration that your graphics driver cannot deliver. For instance, it may ask for a certain number of multisamples that the driver cannot satisfy, or something like that. It’s usually not something to worry about, except if you rely on that particular framebuffer requirement for stuff like multisampling. In any case, it has nothing to do with this error:

This means that Showbase gets instantiated multiple times. The easiest way for this to happen is if each test imports DirectStart, which should really only be imported once. You should make sure that tests don’t import DirectStart themselves, or otherwise instantiate ShowBase.

I’m not sure why it would not occur on Mac. Perhaps your test suite software runs tests differently on different platforms?

Thanks. I thought they were probably unrelated, but it is curious that I get the warning and the error only on Windows, and only get the warning when I am using offscreen. Everything is exactly the same on both setups, except that Python is at 2.72 on the Mac, and 2.73 on the Windows machine. Each test does instantiate ShowBase, but then destroys it during teardown. I do as much testing as I can without ShowBase, but sometimes that is the only way. You do need ShowBase to render offscreen, I think? I wonder if there is a difference in the way unittest itself does setup and teardown on Windows vs. Mac.


You should avoid creating and destroying ShowBase. Could you instead create a single instance for the lifetime of the application?

I had thought about this, but for some reason discarded the idea, so I’m glad you brought it up. The whole reason for a setUpClass is so that you don’t have to run expensive methods multiple times for tests, and I’d say this qualifies! So, I re-did my tests, setting up my world in a setupClass instead of setup, and all is much better. My methods should work no matter where I am in the game, so it shouldn’t matter if I just ran init or not. Thanks for the kick in the butt!