我有一个包含
的单元测试hana::for_each(hana::accessors<Struct>(), [&s](const auto& accessor) {
const auto& member = hana::second(accessor)(s); // No copying
});
其中包含用于测试信号处理程序和GUI类的单元测试。当我从shell运行import gtk
时,这很正常,因为我连接了X11显示器。但是,当我尝试运行tox时,我得到:
py.test
我可以在______________________ ERROR collecting tests/test_gui.py ______________________
tests/test_gui.py:17: in <module>
from rprs_bootstrap.gui import GUI
src/gui.py:12: in <module>
import gtk.glade
.tox/py27/lib/python2.7/site-packages/gtk-2.0/gtk/__init__.py:64: in <module>
_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
内启动一个Xvfb服务器,但这似乎不够优雅。 有任何建议吗?