Commit b860ec23 authored by Morten Welinder's avatar Morten Welinder

Introspection: add test to ensure we use in-tree Gnm.py overrides

I.e., make sure we test the right code.
parent 53bf4f80
......@@ -33,7 +33,11 @@ Gnm.ValueType.__str__ = _valuetype_str
class Value(Gnm.Value):
def __str__(self):
return self.type_of().value_name + ":" + self.get_as_string()
fmt = self.v_any.fmt
main = self.type_of().value_name + "," + self.get_as_string()
if fmt is not None:
main += "," + str(fmt)
return "{" + main + "}";
Value = override(Value)
__all__.append('Value')
......
......@@ -184,7 +184,8 @@ INTROSPECTION_TSTS = \
t3000-introspection-basic.pl \
t3001-introspection-simple.pl \
t3002-introspection-io.pl \
t3003-introspection-plugins.pl
t3003-introspection-plugins.pl \
t3004-introspection-overrides.pl
INTROSPECTION_SUPPS = \
$(INTROSPECTION_TSTS:.pl=.py)
......
#!/usr/bin/perl -w
# -----------------------------------------------------------------------------
use strict;
use lib ($0 =~ m|^(.*/)| ? $1 : ".");
use GnumericTest;
&setup_python_environment ();
my $python_script = $0;
$python_script =~ s/\.pl$/.py/;
&test_command ($PYTHON . ' ' . &GnumericTest::quotearg ($python_script),
sub { /^Using in-tree / });
#!/usr/bin/python
# -----------------------------------------------------------------------------
import gi
gi.require_version('Gnm', '1.12')
from gi.repository import Gnm
Gnm.init()
import os.path;
def atomize_path(p):
res=[]
while 1:
h,t = os.path.split(p)
if t != "":
res.append(t)
if h == "":
break
if h == p:
res.append(h)
break;
p = h
res.reverse()
return res
l=atomize_path(os.path.dirname(gi.overrides.Gnm.__file__))
if len(l) > 3 and l[-3] == "introspection":
print("Using in-tree gi.overrides.Gnm")
else:
print("Using installed gi.overrides.Gnm at {}"
.format (gi.overrides.Gnm.__file__))
print Gnm.Value.new_int(12)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment