Python 是否可以使用tox测试GTK3应用程序?

Python 是否可以使用tox测试GTK3应用程序?,python,python-2.7,pytest,tox,Python,Python 2.7,Pytest,Tox,我尝试做正确的事情,并为GTK3应用程序编写一些单元测试。 我的堆栈由Python2.7、tox和pytest组成 使用pytest运行以下各项工作正常: import gi gi.require_version('Gdk', '3.0') # NOQA from gi.repository import Gtk def test_smoke(request): box = Gtk.Box() assert box 从tox中运行相同的命令(使用:sitepackages=

我尝试做正确的事情,并为GTK3应用程序编写一些单元测试。 我的堆栈由Python2.7、tox和pytest组成

使用pytest运行以下各项工作正常:

import gi
gi.require_version('Gdk', '3.0')  # NOQA
from gi.repository import Gtk

def test_smoke(request):
    box = Gtk.Box()
    assert box
从tox中运行相同的命令(使用:
sitepackages=True
)失败,出现segfault:

platform linux2 -- Python 2.7.11+, pytest-2.9.1, py-1.4.31, pluggy-0.3.1
rootdir: /home/elbenfreund/projects/hamster-gtk, inifile: setup.cfg
plugins: faker-1.1.0, factoryboy-1.1.6, mock-0.11.0
collected 1 items 

tests/test_minimal.py Makefile:79: die Regel für Ziel „test2“ scheiterte
make: *** [test2] Speicherzugriffsfehler
ERROR: InvocationError: '/usr/bin/make test2'
dmesg显示了以下内容:

[6256.753073]py.test[14834]:0 ip 00007f80ba7e10b9 sp 00007FFECA4 EDC70故障4在libgtk-3.so.0.2000.6[7f80ba512000+6d0000]

这是否意味着这是GTK问题(看到SEGFULT发生在libgtk中)?但为什么它只在tox环境中触发

我不想误用它作为错误追踪器,而是要确保我对问题的理解足够好,足以困扰正确的人(如果不是我愚蠢的话)。

对于某种类似的错误(不可能为GTK应用程序运行测试套件,尽管它们在每个venv中都运行得非常好,
pytest
),我必须在
tox.ini
中的
[testenv]
下添加
passenv=DISPLAY XAUTHORITY
。无法保证这也能解决问题,但可能值得一试。对于某种类似的错误(无法运行GTK应用程序的测试套件,尽管它们在每个venv内的
pytest
运行得非常好),我必须在
tox.ini
中的
[testenv]
下添加
passenv=DISPLAY XAUTHORITY
。不能保证这也能解决问题,但可能值得一试。