Merge branch 'revert-untested-codegen-changes' into 'main'

Revert "Don't skip dbus-codegen tests on Win32"

See merge request GNOME/glib!3870
This commit is contained in:
Philip Withnall 2024-02-02 10:22:02 +00:00
commit 53ded42fbb
2 changed files with 68 additions and 46 deletions

View File

@ -24,7 +24,6 @@
import argparse import argparse
import os import os
import sys import sys
from contextlib import contextmanager
from . import config from . import config
from . import dbustypes from . import dbustypes
@ -64,14 +63,6 @@ def find_prop(iface, prop):
return None return None
@contextmanager
def file_or_stdout(filename):
if filename is None or filename == "stdout":
yield sys.stdout
else:
with open(filename, "w") as outfile:
yield outfile
def apply_annotation(iface_list, iface, method, signal, prop, arg, key, value): def apply_annotation(iface_list, iface, method, signal, prop, arg, key, value):
iface_obj = None iface_obj = None
for i in iface_list: for i in iface_list:
@ -455,7 +446,7 @@ def codegen_main():
rst_gen.generate(rst, args.output_directory) rst_gen.generate(rst, args.output_directory)
if args.header: if args.header:
with file_or_stdout(h_file) as outfile: with open(h_file, "w") as outfile:
gen = codegen.HeaderCodeGenerator( gen = codegen.HeaderCodeGenerator(
all_ifaces, all_ifaces,
args.c_namespace, args.c_namespace,
@ -472,7 +463,7 @@ def codegen_main():
gen.generate() gen.generate()
if args.body: if args.body:
with file_or_stdout(c_file) as outfile: with open(c_file, "w") as outfile:
gen = codegen.CodeGenerator( gen = codegen.CodeGenerator(
all_ifaces, all_ifaces,
args.c_namespace, args.c_namespace,
@ -487,7 +478,7 @@ def codegen_main():
gen.generate() gen.generate()
if args.interface_info_header: if args.interface_info_header:
with file_or_stdout(h_file) as outfile: with open(h_file, "w") as outfile:
gen = codegen.InterfaceInfoHeaderCodeGenerator( gen = codegen.InterfaceInfoHeaderCodeGenerator(
all_ifaces, all_ifaces,
args.c_namespace, args.c_namespace,
@ -502,7 +493,7 @@ def codegen_main():
gen.generate() gen.generate()
if args.interface_info_body: if args.interface_info_body:
with file_or_stdout(c_file): with open(c_file, "w") as outfile:
gen = codegen.InterfaceInfoBodyCodeGenerator( gen = codegen.InterfaceInfoBodyCodeGenerator(
all_ifaces, all_ifaces,
args.c_namespace, args.c_namespace,

View File

@ -41,6 +41,10 @@ import taptestrunner
Result = collections.namedtuple("Result", ("info", "out", "err", "subs")) Result = collections.namedtuple("Result", ("info", "out", "err", "subs"))
def on_win32():
return sys.platform.find("win") != -1
class TestCodegen(unittest.TestCase): class TestCodegen(unittest.TestCase):
"""Integration test for running gdbus-codegen. """Integration test for running gdbus-codegen.
@ -351,9 +355,10 @@ class TestCodegen(unittest.TestCase):
with self.assertRaises(subprocess.CalledProcessError): with self.assertRaises(subprocess.CalledProcessError):
self.runCodegen() self.runCodegen()
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_empty_interface_header(self): def test_empty_interface_header(self):
"""Test generating a header with an empty interface file.""" """Test generating a header with an empty interface file."""
result = self.runCodegenWithInterface("", "--output", "stdout", "--header") result = self.runCodegenWithInterface("", "--output", "/dev/stdout", "--header")
self.assertEqual("", result.err) self.assertEqual("", result.err)
self.assertEqual( self.assertEqual(
"""{standard_top_comment} """{standard_top_comment}
@ -374,9 +379,10 @@ G_END_DECLS
result.out.strip(), result.out.strip(),
) )
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_empty_interface_body(self): def test_empty_interface_body(self):
"""Test generating a body with an empty interface file.""" """Test generating a body with an empty interface file."""
result = self.runCodegenWithInterface("", "--output", "stdout", "--body") result = self.runCodegenWithInterface("", "--output", "/dev/stdout", "--body")
self.assertEqual("", result.err) self.assertEqual("", result.err)
self.assertEqual( self.assertEqual(
"""{standard_top_comment} """{standard_top_comment}
@ -395,6 +401,7 @@ G_END_DECLS
result.out.strip(), result.out.strip(),
) )
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_reproducible(self): def test_reproducible(self):
"""Test builds are reproducible regardless of file ordering.""" """Test builds are reproducible regardless of file ordering."""
xml_contents1 = """ xml_contents1 = """
@ -437,7 +444,7 @@ G_END_DECLS
xml_file1.name, xml_file1.name,
xml_file2.name, xml_file2.name,
"--output", "--output",
"stdout", "/dev/stdout",
header_or_body, header_or_body,
) )
self.assertEqual("", result1.err) self.assertEqual("", result1.err)
@ -446,7 +453,7 @@ G_END_DECLS
xml_file2.name, xml_file2.name,
xml_file1.name, xml_file1.name,
"--output", "--output",
"stdout", "/dev/stdout",
header_or_body, header_or_body,
) )
self.assertEqual("", result2.err) self.assertEqual("", result2.err)
@ -646,32 +653,35 @@ G_END_DECLS
rst, rst,
) )
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_glib_min_required_invalid(self): def test_glib_min_required_invalid(self):
"""Test running with an invalid --glib-min-required.""" """Test running with an invalid --glib-min-required."""
with self.assertRaises(subprocess.CalledProcessError): with self.assertRaises(subprocess.CalledProcessError):
self.runCodegenWithInterface( self.runCodegenWithInterface(
"", "",
"--output", "--output",
"stdout", "/dev/stdout",
"--body", "--body",
"--glib-min-required", "--glib-min-required",
"hello mum", "hello mum",
) )
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_glib_min_required_too_low(self): def test_glib_min_required_too_low(self):
"""Test running with a --glib-min-required which is too low (and hence """Test running with a --glib-min-required which is too low (and hence
probably a typo).""" probably a typo)."""
with self.assertRaises(subprocess.CalledProcessError): with self.assertRaises(subprocess.CalledProcessError):
self.runCodegenWithInterface( self.runCodegenWithInterface(
"", "--output", "stdout", "--body", "--glib-min-required", "2.6" "", "--output", "/dev/stdout", "--body", "--glib-min-required", "2.6"
) )
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_glib_min_required_major_only(self): def test_glib_min_required_major_only(self):
"""Test running with a --glib-min-required which contains only a major version.""" """Test running with a --glib-min-required which contains only a major version."""
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
"", "",
"--output", "--output",
"stdout", "/dev/stdout",
"--header", "--header",
"--glib-min-required", "--glib-min-required",
"3", "3",
@ -681,38 +691,43 @@ G_END_DECLS
self.assertEqual("", result.err) self.assertEqual("", result.err)
self.assertNotEqual("", result.out.strip()) self.assertNotEqual("", result.out.strip())
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_glib_min_required_with_micro(self): def test_glib_min_required_with_micro(self):
"""Test running with a --glib-min-required which contains a micro version.""" """Test running with a --glib-min-required which contains a micro version."""
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
"", "--output", "stdout", "--header", "--glib-min-required", "2.46.2" "", "--output", "/dev/stdout", "--header", "--glib-min-required", "2.46.2"
) )
self.assertEqual("", result.err) self.assertEqual("", result.err)
self.assertNotEqual("", result.out.strip()) self.assertNotEqual("", result.out.strip())
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_glib_max_allowed_too_low(self): def test_glib_max_allowed_too_low(self):
"""Test running with a --glib-max-allowed which is too low (and hence """Test running with a --glib-max-allowed which is too low (and hence
probably a typo).""" probably a typo)."""
with self.assertRaises(subprocess.CalledProcessError): with self.assertRaises(subprocess.CalledProcessError):
self.runCodegenWithInterface( self.runCodegenWithInterface(
"", "--output", "stdout", "--body", "--glib-max-allowed", "2.6" "", "--output", "/dev/stdout", "--body", "--glib-max-allowed", "2.6"
) )
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_glib_max_allowed_major_only(self): def test_glib_max_allowed_major_only(self):
"""Test running with a --glib-max-allowed which contains only a major version.""" """Test running with a --glib-max-allowed which contains only a major version."""
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
"", "--output", "stdout", "--header", "--glib-max-allowed", "3" "", "--output", "/dev/stdout", "--header", "--glib-max-allowed", "3"
) )
self.assertEqual("", result.err) self.assertEqual("", result.err)
self.assertNotEqual("", result.out.strip()) self.assertNotEqual("", result.out.strip())
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_glib_max_allowed_with_micro(self): def test_glib_max_allowed_with_micro(self):
"""Test running with a --glib-max-allowed which contains a micro version.""" """Test running with a --glib-max-allowed which contains a micro version."""
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
"", "--output", "stdout", "--header", "--glib-max-allowed", "2.46.2" "", "--output", "/dev/stdout", "--header", "--glib-max-allowed", "2.46.2"
) )
self.assertEqual("", result.err) self.assertEqual("", result.err)
self.assertNotEqual("", result.out.strip()) self.assertNotEqual("", result.out.strip())
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_glib_max_allowed_unstable(self): def test_glib_max_allowed_unstable(self):
"""Test running with a --glib-max-allowed which is unstable. It should """Test running with a --glib-max-allowed which is unstable. It should
be rounded up to the next stable version number, and hence should not be rounded up to the next stable version number, and hence should not
@ -720,7 +735,7 @@ G_END_DECLS
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
"", "",
"--output", "--output",
"stdout", "/dev/stdout",
"--header", "--header",
"--glib-max-allowed", "--glib-max-allowed",
"2.63", "2.63",
@ -730,6 +745,7 @@ G_END_DECLS
self.assertEqual("", result.err) self.assertEqual("", result.err)
self.assertNotEqual("", result.out.strip()) self.assertNotEqual("", result.out.strip())
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_glib_max_allowed_less_than_min_required(self): def test_glib_max_allowed_less_than_min_required(self):
"""Test running with a --glib-max-allowed which is less than """Test running with a --glib-max-allowed which is less than
--glib-min-required.""" --glib-min-required."""
@ -737,7 +753,7 @@ G_END_DECLS
self.runCodegenWithInterface( self.runCodegenWithInterface(
"", "",
"--output", "--output",
"stdout", "/dev/stdout",
"--body", "--body",
"--glib-max-allowed", "--glib-max-allowed",
"2.62", "2.62",
@ -745,6 +761,7 @@ G_END_DECLS
"2.64", "2.64",
) )
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_dbus_types(self): def test_dbus_types(self):
bad_types = [ bad_types = [
"{vs}", # Bad dictionary key type "{vs}", # Bad dictionary key type
@ -781,7 +798,7 @@ G_END_DECLS
</node>""" </node>"""
with self.assertRaises(subprocess.CalledProcessError): with self.assertRaises(subprocess.CalledProcessError):
self.runCodegenWithInterface( self.runCodegenWithInterface(
interface_xml, "--output", "stdout", "--body" interface_xml, "--output", "/dev/stdout", "--body"
) )
good_types = [ good_types = [
"si{s{b(ybnqiuxtdh)}}{yv}{nv}{dv}", "si{s{b(ybnqiuxtdh)}}{yv}{nv}{dv}",
@ -798,10 +815,11 @@ G_END_DECLS
</interface> </interface>
</node>""" </node>"""
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, "--output", "stdout", "--body" interface_xml, "--output", "/dev/stdout", "--body"
) )
self.assertEqual("", result.err) self.assertEqual("", result.err)
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_unix_fd_types_and_annotations(self): def test_unix_fd_types_and_annotations(self):
"""Test an interface with `h` arguments, no annotation, and GLib < 2.64. """Test an interface with `h` arguments, no annotation, and GLib < 2.64.
@ -829,7 +847,7 @@ G_END_DECLS
# Try without specifying --glib-min-required. # Try without specifying --glib-min-required.
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, "--output", "stdout", "--header" interface_xml, "--output", "/dev/stdout", "--header"
) )
self.assertEqual("", result.err) self.assertEqual("", result.err)
self.assertEqual(result.out.strip().count("GUnixFDList"), 6) self.assertEqual(result.out.strip().count("GUnixFDList"), 6)
@ -838,7 +856,7 @@ G_END_DECLS
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, interface_xml,
"--output", "--output",
"stdout", "/dev/stdout",
"--header", "--header",
"--glib-min-required", "--glib-min-required",
"2.32", "2.32",
@ -852,7 +870,7 @@ G_END_DECLS
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, interface_xml,
"--output", "--output",
"stdout", "/dev/stdout",
"--header", "--header",
"--glib-min-required", "--glib-min-required",
"2.64", "2.64",
@ -860,6 +878,7 @@ G_END_DECLS
self.assertEqual("", result.err) self.assertEqual("", result.err)
self.assertEqual(result.out.strip().count("GUnixFDList"), 18) self.assertEqual(result.out.strip().count("GUnixFDList"), 18)
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_call_flags_and_timeout_method_args(self): def test_call_flags_and_timeout_method_args(self):
"""Test that generated method call functions have @call_flags and """Test that generated method call functions have @call_flags and
@timeout_msec args if and only if GLib >= 2.64. @timeout_msec args if and only if GLib >= 2.64.
@ -873,7 +892,7 @@ G_END_DECLS
# Try without specifying --glib-min-required. # Try without specifying --glib-min-required.
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, "--output", "stdout", "--header" interface_xml, "--output", "/dev/stdout", "--header"
) )
self.assertEqual("", result.err) self.assertEqual("", result.err)
self.assertEqual(result.out.strip().count("GDBusCallFlags call_flags,"), 0) self.assertEqual(result.out.strip().count("GDBusCallFlags call_flags,"), 0)
@ -883,7 +902,7 @@ G_END_DECLS
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, interface_xml,
"--output", "--output",
"stdout", "/dev/stdout",
"--header", "--header",
"--glib-min-required", "--glib-min-required",
"2.32", "2.32",
@ -897,7 +916,7 @@ G_END_DECLS
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, interface_xml,
"--output", "--output",
"stdout", "/dev/stdout",
"--header", "--header",
"--glib-min-required", "--glib-min-required",
"2.64", "2.64",
@ -906,6 +925,7 @@ G_END_DECLS
self.assertEqual(result.out.strip().count("GDBusCallFlags call_flags,"), 2) self.assertEqual(result.out.strip().count("GDBusCallFlags call_flags,"), 2)
self.assertEqual(result.out.strip().count("gint timeout_msec,"), 2) self.assertEqual(result.out.strip().count("gint timeout_msec,"), 2)
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_generate_signal_id_simple_signal(self): def test_generate_signal_id_simple_signal(self):
"""Test that signals IDs are used to emit signals""" """Test that signals IDs are used to emit signals"""
interface_xml = """ interface_xml = """
@ -919,7 +939,7 @@ G_END_DECLS
</node>""" </node>"""
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, "--output", "stdout", "--body" interface_xml, "--output", "/dev/stdout", "--body"
) )
stripped_out = result.out.strip() stripped_out = result.out.strip()
self.assertFalse(result.err) self.assertFalse(result.err)
@ -937,6 +957,7 @@ G_END_DECLS
1, 1,
) )
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_generate_signal_id_multiple_signals_types(self): def test_generate_signal_id_multiple_signals_types(self):
"""Test that signals IDs are used to emit signals for all types""" """Test that signals IDs are used to emit signals for all types"""
@ -957,7 +978,7 @@ G_END_DECLS
</node>""" </node>"""
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, "--output", "stdout", "--body" interface_xml, "--output", "/dev/stdout", "--body"
) )
stripped_out = result.out.strip() stripped_out = result.out.strip()
self.assertFalse(result.err) self.assertFalse(result.err)
@ -976,6 +997,7 @@ G_END_DECLS
1, 1,
) )
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_generate_signal_id_multiple_signal_args_types(self): def test_generate_signal_id_multiple_signal_args_types(self):
"""Test that signals IDs are used to emit signals for all types""" """Test that signals IDs are used to emit signals for all types"""
@ -994,7 +1016,7 @@ G_END_DECLS
</node>""" </node>"""
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, "--output", "stdout", "--body" interface_xml, "--output", "/dev/stdout", "--body"
) )
stripped_out = result.out.strip() stripped_out = result.out.strip()
self.assertFalse(result.err) self.assertFalse(result.err)
@ -1014,6 +1036,7 @@ G_END_DECLS
1, 1,
) )
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_generate_signals_marshaller_simple_signal(self): def test_generate_signals_marshaller_simple_signal(self):
"""Test that signals marshaller is generated for simple signal""" """Test that signals marshaller is generated for simple signal"""
interface_xml = """ interface_xml = """
@ -1027,7 +1050,7 @@ G_END_DECLS
</node>""" </node>"""
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, "--output", "stdout", "--body" interface_xml, "--output", "/dev/stdout", "--body"
) )
stripped_out = result.out.strip() stripped_out = result.out.strip()
self.assertFalse(result.err) self.assertFalse(result.err)
@ -1043,6 +1066,7 @@ G_END_DECLS
self.assertIs(stripped_out.count(f"{func_name} ("), 1) self.assertIs(stripped_out.count(f"{func_name} ("), 1)
self.assertIs(stripped_out.count("g_cclosure_marshal_VOID__VOID (closure"), 2) self.assertIs(stripped_out.count("g_cclosure_marshal_VOID__VOID (closure"), 2)
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_generate_signals_marshaller_single_typed_args(self): def test_generate_signals_marshaller_single_typed_args(self):
"""Test that signals marshaller is generated for each known type""" """Test that signals marshaller is generated for each known type"""
for t, props in self.ARGUMENTS_TYPES.items(): for t, props in self.ARGUMENTS_TYPES.items():
@ -1058,7 +1082,7 @@ G_END_DECLS
</node>""" </node>"""
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, "--output", "stdout", "--body" interface_xml, "--output", "/dev/stdout", "--body"
) )
stripped_out = result.out.strip() stripped_out = result.out.strip()
self.assertFalse(result.err) self.assertFalse(result.err)
@ -1089,6 +1113,7 @@ G_END_DECLS
1, 1,
) )
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_generate_signals_marshallers_multiple_args(self): def test_generate_signals_marshallers_multiple_args(self):
"""Test that signals marshallers are generated""" """Test that signals marshallers are generated"""
generated_args = [ generated_args = [
@ -1107,7 +1132,7 @@ G_END_DECLS
</node>""" </node>"""
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, "--output", "stdout", "--body" interface_xml, "--output", "/dev/stdout", "--body"
) )
stripped_out = result.out.strip() stripped_out = result.out.strip()
self.assertFalse(result.err) self.assertFalse(result.err)
@ -1132,6 +1157,7 @@ G_END_DECLS
) )
index += 1 index += 1
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_generate_methods_marshaller_simple_method(self): def test_generate_methods_marshaller_simple_method(self):
"""Test that methods marshaller is generated for simple method""" """Test that methods marshaller is generated for simple method"""
interface_xml = """ interface_xml = """
@ -1145,7 +1171,7 @@ G_END_DECLS
</node>""" </node>"""
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, "--output", "stdout", "--body" interface_xml, "--output", "/dev/stdout", "--body"
) )
stripped_out = result.out.strip() stripped_out = result.out.strip()
self.assertFalse(result.err) self.assertFalse(result.err)
@ -1176,6 +1202,7 @@ G_END_DECLS
stripped_out.count("_g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure"), 2 stripped_out.count("_g_dbus_codegen_marshal_BOOLEAN__OBJECT (closure"), 2
) )
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_generate_methods_marshaller_single_typed_in_args(self): def test_generate_methods_marshaller_single_typed_in_args(self):
"""Test that methods marshallers are generated for each known type""" """Test that methods marshallers are generated for each known type"""
for t, props in self.ARGUMENTS_TYPES.items(): for t, props in self.ARGUMENTS_TYPES.items():
@ -1190,7 +1217,7 @@ G_END_DECLS
</node>""" </node>"""
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, "--output", "stdout", "--body" interface_xml, "--output", "/dev/stdout", "--body"
) )
stripped_out = result.out.strip() stripped_out = result.out.strip()
self.assertFalse(result.err) self.assertFalse(result.err)
@ -1214,6 +1241,7 @@ G_END_DECLS
1, 1,
) )
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_generate_methods_marshaller_single_typed_out_args(self): def test_generate_methods_marshaller_single_typed_out_args(self):
"""Test that methods marshallers are generated for each known type""" """Test that methods marshallers are generated for each known type"""
for t, props in self.ARGUMENTS_TYPES.items(): for t, props in self.ARGUMENTS_TYPES.items():
@ -1228,7 +1256,7 @@ G_END_DECLS
</node>""" </node>"""
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, "--output", "stdout", "--body" interface_xml, "--output", "/dev/stdout", "--body"
) )
stripped_out = result.out.strip() stripped_out = result.out.strip()
self.assertFalse(result.err) self.assertFalse(result.err)
@ -1247,6 +1275,7 @@ G_END_DECLS
) )
self.assertIs(stripped_out.count("(param_values + 2)"), 0) self.assertIs(stripped_out.count("(param_values + 2)"), 0)
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_generate_methods_marshallers_multiple_in_args(self): def test_generate_methods_marshallers_multiple_in_args(self):
"""Test that methods marshallers are generated""" """Test that methods marshallers are generated"""
generated_args = [ generated_args = [
@ -1272,7 +1301,7 @@ G_END_DECLS
</node>""" </node>"""
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, "--output", "stdout", "--body" interface_xml, "--output", "/dev/stdout", "--body"
) )
stripped_out = result.out.strip() stripped_out = result.out.strip()
self.assertFalse(result.err) self.assertFalse(result.err)
@ -1315,6 +1344,7 @@ G_END_DECLS
self.assertIs(stripped_out.count(f"{func_name},"), 1) self.assertIs(stripped_out.count(f"{func_name},"), 1)
self.assertIs(stripped_out.count(f"{func_name} ("), 1) self.assertIs(stripped_out.count(f"{func_name} ("), 1)
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_generate_methods_marshallers_multiple_out_args(self): def test_generate_methods_marshallers_multiple_out_args(self):
"""Test that methods marshallers are generated""" """Test that methods marshallers are generated"""
generated_args = [ generated_args = [
@ -1332,7 +1362,7 @@ G_END_DECLS
</node>""" </node>"""
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, "--output", "stdout", "--body" interface_xml, "--output", "/dev/stdout", "--body"
) )
stripped_out = result.out.strip() stripped_out = result.out.strip()
self.assertFalse(result.err) self.assertFalse(result.err)
@ -1362,6 +1392,7 @@ G_END_DECLS
1, 1,
) )
@unittest.skipIf(on_win32(), "requires /dev/stdout")
def test_generate_methods_marshallers_with_unix_fds(self): def test_generate_methods_marshallers_with_unix_fds(self):
"""Test an interface with `h` arguments""" """Test an interface with `h` arguments"""
interface_xml = """ interface_xml = """
@ -1376,7 +1407,7 @@ G_END_DECLS
</node>""" </node>"""
result = self.runCodegenWithInterface( result = self.runCodegenWithInterface(
interface_xml, "--output", "stdout", "--body" interface_xml, "--output", "/dev/stdout", "--body"
) )
stripped_out = result.out.strip() stripped_out = result.out.strip()
self.assertFalse(result.err) self.assertFalse(result.err)