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