xref: /OK3568_Linux_fs/yocto/poky/meta/lib/oeqa/runtime/cases/gi.py (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun#
2*4882a593Smuzhiyun# SPDX-License-Identifier: MIT
3*4882a593Smuzhiyun#
4*4882a593Smuzhiyun
5*4882a593Smuzhiyunimport os
6*4882a593Smuzhiyun
7*4882a593Smuzhiyunfrom oeqa.runtime.case import OERuntimeTestCase
8*4882a593Smuzhiyunfrom oeqa.core.decorator.depends import OETestDepends
9*4882a593Smuzhiyunfrom oeqa.runtime.decorator.package import OEHasPackage
10*4882a593Smuzhiyun
11*4882a593Smuzhiyunclass GObjectIntrospectionTest(OERuntimeTestCase):
12*4882a593Smuzhiyun
13*4882a593Smuzhiyun    @OETestDepends(["ssh.SSHTest.test_ssh"])
14*4882a593Smuzhiyun    @OEHasPackage(["python3-pygobject"])
15*4882a593Smuzhiyun    def test_python(self):
16*4882a593Smuzhiyun        script = """from gi.repository import GLib; print(GLib.markup_escape_text("<testing&testing>"))"""
17*4882a593Smuzhiyun        status, output = self.target.run("python3 -c '%s'" % script)
18*4882a593Smuzhiyun        self.assertEqual(status, 0, msg="Python failed (%s)" % (output))
19*4882a593Smuzhiyun        self.assertEqual(output, "&lt;testing&amp;testing&gt;", msg="Unexpected output (%s)" % output)
20