title: RuntimeError: could not open display
body: <p>I have a unit test which contains </p>
  
  <pre><code>import gtk
  </code></pre>
  
  <p>Which contains unit tests to test the signal handler and GUI classes. This works fine when I run <code>py.test</code> from the shell as I have an X11 display connected. However, when I try to run tox, I get:</p>
  
  <pre><code>______________________ ERROR collecting tests/test_gui.py ______________________
  tests/test_gui.py:17: in &lt;module&gt;
      from rprs_bootstrap.gui import GUI
  src/gui.py:12: in &lt;module&gt;
      import gtk.glade
  .tox/py27/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.py:64: in &lt;module&gt;
      _init()
  .tox/py27/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.py:52: in _init
      _gtk.init_check()
  E   RuntimeError: could not open display
  !!!!!!!!!!!!!!!!!!!! Interrupted: stopping after 1 failures !!!!!!!!!!!!!!!!!!!!
  =========================== 1 error in 0.34 seconds ============================
  make: *** [tox] Error 2
  </code></pre>
  
  <p>I could start a <a href="https://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml" rel="nofollow">Xvfb</a> server from within <code>tox.ini</code> but that seems inelegant.  <em>Any suggestions?</em></p>