-commit 086c10133d6d9ac155e3a7fee7dde198aea1343d
-Author: Simon Feltman <sfeltman@src.gnome.org>
-Date: Fri May 2 21:36:25 2014 -0700
-
- PEP8 fixes
+commit 3a2bfc8bf01fcae386355bc3652780e198e54d49
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Mon Apr 14 23:33:52 2014 +0200
- Use infix 'not' instead of prefixed.
- Don't use double comments (##).
- Use space between comment and text.
- Un-comment tests that now work.
- Move broken (and won't fix) implicit int64 signal tests into
- a new skipped test function.
+ Raise TypeError if arguments are passed to Boxed.__init__
- gi/overrides/GIMarshallingTests.py | 4 ++--
- gi/overrides/Gio.py | 4 ++--
- gi/overrides/Gtk.py | 6 +++---
- gi/types.py | 2 +-
- pygtkcompat/pygtkcompat.py | 4 ++--
- tests/test_everything.py | 1 -
- tests/test_gi.py | 9 +++------
- tests/test_iochannel.py | 2 +-
- tests/test_option.py | 2 +-
- tests/test_signal.py | 28 +++++++++++++---------------
- 10 files changed, 28 insertions(+), 34 deletions(-)
+ This is a partial revert of
+ https://git.gnome.org/browse/pygobject/commit/?id=2f2069c9efcd8
+ which removed a type check in __new__. This adds it back
+ into __init__. Overrides which define __new__ now have to
+ filter out any arguments in __init__ and not the other way
+ around, which is a bit less surprising in the common case.
-commit 382bb7e9e84ae142d18832409e4f5e969876c84c
-Author: Simon Feltman <sfeltman@src.gnome.org>
-Date: Mon May 26 03:01:13 2014 -0700
+ https://bugzilla.gnome.org/show_bug.cgi?id=727810
- Python 3.4 make check fixes
+ gi/overrides/GLib.py | 6 ++++++
+ gi/overrides/Gtk.py | 6 ++++++
+ gi/overrides/Pango.py | 3 +++
+ gi/pygi-boxed.c | 6 ++++++
+ tests/test_gi.py | 4 ++++
+ 5 files changed, 25 insertions(+)
- Use unittest.skip() instead of unittest.expectedFailure() for
- tests which
- pass in GI 1.39.0. This is needed to get rid of unexpected successes
- which
- fail unittesting in Python 3.4.
- Silence deprecation warning when using imp.reload.
+commit 906977047df2fb2f394410e4ebf360b69af8dcfe
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Mon Apr 14 15:40:50 2014 +0200
- https://bugzilla.gnome.org/show_bug.cgi?id=730411
+ Gdk.Event: Override __setattr__ to set fields based on the event type
- pygtkcompat/pygtkcompat.py | 4 +++-
- tests/test_gi.py | 2 +-
- tests/test_repository.py | 4 ++--
- 3 files changed, 6 insertions(+), 4 deletions(-)
+ Pass the setting of attributes through to the underlying union based
+ on event type. This mirrors the logic in __getattr__.
-commit 458ea7555445ec8f0e57c009ca0de985bcfa4d53
-Author: Simon Feltman <sfeltman@src.gnome.org>
-Date: Mon Apr 14 16:23:24 2014 -0700
+ https://bugzilla.gnome.org/show_bug.cgi?id=727810
- configure.ac: post release version bump to 3.12.2
+ gi/overrides/Gdk.py | 7 +++++++
+ tests/test_overrides_gdk.py | 13 ++++++++++---
+ 2 files changed, 17 insertions(+), 3 deletions(-)
- configure.ac | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
+commit 78a0508a4d40e3723b36297ba2d42889dabc1cdd
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Mon Apr 14 13:06:02 2014 +0200
-commit 193b114a6425e5dba0c91d17227a050529ffe40b
-Author: Simon Feltman <sfeltman@src.gnome.org>
-Date: Mon Apr 14 16:15:48 2014 -0700
+ Gdk.Event: Include GdkEventType in __repr__
- release 3.12.1
+ https://bugzilla.gnome.org/show_bug.cgi?id=727810
- NEWS | 5 +++++
- 1 file changed, 5 insertions(+)
+ gi/overrides/Gdk.py | 4 ++++
+ tests/test_overrides_gdk.py | 4 ++++
+ 2 files changed, 8 insertions(+)
-commit 6638b188abed038b4dfa2589826ef36a2145b957
+commit 23965455f060793ffcbc0d8288527d41a667579c
Author: Simon Feltman <sfeltman@src.gnome.org>
Date: Mon Apr 14 15:10:01 2014 -0700
- Fix crash with type checking invalid GObject arguments
+ Fix crash with type checking for GObject arguments
Ensure we have a valid GObject before attempting to call g_type_is_a.
Swap conditional blocks to make if condition more readable.
tests/test_object_marshaling.py | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 45 insertions(+), 9 deletions(-)
-commit 22951466aee024f6199963a4f300b36c8e61c418
+commit 2e853f6a31636d6a26ce91eb30be5bb0326474b1
Author: Paolo Borelli <pborelli@gnome.org>
Date: Sun Mar 30 18:27:59 2014 +0200
gi/pygi-closure.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
-commit db797ce5b4fb81bff10434fe66ad627dfdd4e762
+commit f9e504c79c5ef6e1938e4db5b49115689b9f5c3c
Author: Simon Feltman <sfeltman@src.gnome.org>
-Date: Mon Mar 24 04:27:51 2014 -0700
+Date: Fri Mar 28 19:51:58 2014 -0700
- configure.ac: post release version bump to 3.12.1
+ configure.ac: Update PyGObject wiki link in AC_INIT
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
+commit ee84b5a2c83d88436aec6b62e7a271a3525569e0
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Mon Mar 24 18:57:56 2014 -0700
+
+ Ignore GValueArray deprecations
+
+ Wrap calls to GValueArray related calls with
+ G_GNUC_BEGIN/END_IGNORE_DEPRECATIONS.
+ Although GValueArray is deprecated, we still need to support the
+ marshaling of
+ them in PyGObject. The deprecations add noise to the build processes
+ in which
+ new warnings could be lost. Essentially losing the element of surprise
+ a new
+ warning should have on maintainers.
+
+ gi/pygi-value.c | 23 ++++++++++++++++++++---
+ tests/testhelpermodule.c | 3 +++
+ 2 files changed, 23 insertions(+), 3 deletions(-)
+
+commit ac8b59ee335967efef974ab0aa89128ade9f3d0c
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Mon Mar 24 18:09:10 2014 -0700
+
+ Raise ImportError when importing modules not found in repository
+
+ Raise an ImportError with extra information noting the typelib was not
+ found. This removes the need to log a similar message which adds
+ output
+ noise when attempting controlled imports within try/except statements.
+ In Python 2, the additional information is lost but in Python 3 it
+ shows up.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=726877
+
+ gi/importer.py | 9 ++++-----
+ tests/test_import_machinery.py | 18 ++++++++++++++++++
+ 2 files changed, 22 insertions(+), 5 deletions(-)
+
+commit e604ada06a8ef8f9a06f0638cf183cfeacdc63a9
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Mon Mar 24 18:04:27 2014 -0700
+
+ tests: Rename test_overrides to test_import_machinery
+
+ Rename this test to better suit the contents of the file. This
+ also gives
+ us a more concise location to grow other tests related to import
+ machinery
+ internals.
+
+ https://bugzilla.gnome.org/show_bug.cgi?id=726877
+
+ tests/Makefile.am | 2 +-
+ tests/test_import_machinery.py | 58
+ ++++++++++++++++++++++++++++++++++++++++++
+ tests/test_overrides.py | 58
+ ------------------------------------------
+ 3 files changed, 59 insertions(+), 59 deletions(-)
+
+commit a863e5ec0ac27de49a0ae261fd3a78745cfe84a0
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Mon Mar 24 04:39:47 2014 -0700
+
+ HACKING: Update branch creation instructions to include -b
+
+ HACKING | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 1012cfd58c1d41dd6b040a2d14f395e5578f5e79
+Author: Simon Feltman <sfeltman@src.gnome.org>
+Date: Mon Mar 24 04:35:52 2014 -0700
+
+ configure.ac: post release version bump to 3.13.1
+
+ configure.ac | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
commit 45eda91eac2f6c8ab1a5c38808f96de760196e90
Author: Simon Feltman <sfeltman@src.gnome.org>
Date: Mon Mar 24 03:35:21 2014 -0700
-3.12.2 26-May-2014
- - PEP8 fixes (Simon Feltman)
- - Python 3.4 make check fixes (Simon Feltman) (#730411)
-
-3.12.1 14-Apr-2014
- - Fix crash with type checking invalid GObject arguments
- (Simon Feltman) (#727604)
+3.13.1 28-Apr-2014
+ - Raise TypeError if arguments are passed to Boxed.__init__
+ (Christoph Reiter) (#727810)
+ - Gdk.Event: Override __setattr__ to set fields based on the event type
+ (Christoph Reiter) (#727810)
+ - Gdk.Event: Include GdkEventType in __repr__ (Christoph Reiter) (#727810)
+ - Fix crash with type checking for GObject arguments (Simon Feltman) (#727604)
- Do not leak info of destroy notify (Paolo Borelli)
+ - Ignore GValueArray deprecations (Simon Feltman)
+ - Raise ImportError when importing modules not found in repository
+ (Simon Feltman) (#726877)
+ - tests: Rename test_overrides to test_import_machinery
+ (Simon Feltman) (#726877)
3.12.0 24-Mar-2014
Metadata-Version: 1.0
Name: PyGObject
-Version: 3.12.2
+Version: 3.13.1
Summary: Python bindings for GObject
Home-page: http://www.pygtk.org/
Author: James Henstridge
Maintainer: Johan Dahlin
Maintainer-email: johan@gnome.org
License: GNU LGPL
-Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.12/pygobject-3.12.2.tar.gz
+Download-url: ftp://ftp.gnome.org/pub/GNOME/sources/pygobject/3.13/pygobject-3.13.1.tar.gz
Description: Python bindings for GLib and GObject
Platform: POSIX, Windows
Classifier: Development Status :: 5 - Production/Stable
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for pygobject 3.12.2.
+# Generated by GNU Autoconf 2.69 for pygobject 3.13.1.
#
# Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject>.
#
# Identity of this package.
PACKAGE_NAME='pygobject'
PACKAGE_TARNAME='pygobject'
-PACKAGE_VERSION='3.12.2'
-PACKAGE_STRING='pygobject 3.12.2'
+PACKAGE_VERSION='3.13.1'
+PACKAGE_STRING='pygobject 3.13.1'
PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject'
-PACKAGE_URL='https://live.gnome.org/PyGObject/'
+PACKAGE_URL='https://wiki.gnome.org/Projects/PyGObject/'
ac_unique_file="gi/gimodule.c"
# Factoring default headers for most tests.
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures pygobject 3.12.2 to adapt to many kinds of systems.
+\`configure' configures pygobject 3.13.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of pygobject 3.12.2:";;
+ short | recursive ) echo "Configuration of pygobject 3.13.1:";;
esac
cat <<\_ACEOF
it to find libraries and programs with nonstandard names/locations.
Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject>.
-pygobject home page: <https://live.gnome.org/PyGObject/>.
+pygobject home page: <https://wiki.gnome.org/Projects/PyGObject/>.
_ACEOF
ac_status=$?
fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-pygobject configure 3.12.2
+pygobject configure 3.13.1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by pygobject $as_me 3.12.2, which was
+It was created by pygobject $as_me 3.13.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
PYGOBJECT_MAJOR_VERSION=3
-$as_echo "#define PYGOBJECT_MINOR_VERSION 12" >>confdefs.h
+$as_echo "#define PYGOBJECT_MINOR_VERSION 13" >>confdefs.h
-PYGOBJECT_MINOR_VERSION=12
+PYGOBJECT_MINOR_VERSION=13
-$as_echo "#define PYGOBJECT_MICRO_VERSION 2" >>confdefs.h
+$as_echo "#define PYGOBJECT_MICRO_VERSION 1" >>confdefs.h
-PYGOBJECT_MICRO_VERSION=2
+PYGOBJECT_MICRO_VERSION=1
ac_config_headers="$ac_config_headers config.h"
# Define the identity of the package.
PACKAGE='pygobject'
- VERSION='3.12.2'
+ VERSION='3.13.1'
cat >>confdefs.h <<_ACEOF
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by pygobject $as_me 3.12.2, which was
+This file was extended by pygobject $as_me 3.13.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
$config_commands
Report bugs to <http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject>.
-pygobject home page: <https://live.gnome.org/PyGObject/>."
+pygobject home page: <https://wiki.gnome.org/Projects/PyGObject/>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-pygobject config.status 3.12.2
+pygobject config.status 3.13.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
dnl the pygobject version number
m4_define(pygobject_major_version, 3)
-m4_define(pygobject_minor_version, 12)
-m4_define(pygobject_micro_version, 2)
+m4_define(pygobject_minor_version, 13)
+m4_define(pygobject_micro_version, 1)
m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pygobject_micro_version)
dnl versions of packages we require ...
AC_INIT([pygobject],[pygobject_version],
[http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject],
- [pygobject],[https://live.gnome.org/PyGObject/])
+ [pygobject],[https://wiki.gnome.org/Projects/PyGObject/])
AC_SUBST(ACLOCAL_AMFLAGS, "-I m4 -I .")
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_SRCDIR([gi/gimodule.c])
# USA
from __future__ import absolute_import
-import logging
import sys
from ._gi import Repository
if path != self.path:
return
- if not repository.enumerate_versions(namespace):
- logging.error('Could not find any typelib for %s', namespace)
- return None
- else:
+ if repository.enumerate_versions(namespace):
return self
+ else:
+ raise ImportError('cannot import name %s, '
+ 'introspection typelib not found' % namespace)
def load_module(self, fullname):
if fullname in sys.modules:
def __init__(self, long_):
GIMarshallingTests.OverridesObject.__init__(self)
# FIXME: doesn't work yet
- # self.long_ = long_
+ #self.long_ = long_
@classmethod
def new(cls, long_):
self = GIMarshallingTests.OverridesObject.new()
# FIXME: doesn't work yet
- # self.long_ = long_
+ #self.long_ = long_
return self
def method(self):
setattr(source, '__pygi_custom_source', True)
return source
+ def __init__(self, *args, **kwargs):
+ return super(Source, self).__init__()
+
def __del__(self):
if hasattr(self, '__pygi_custom_source'):
self.unref()
return GLib.IOChannel.win32_new_fd(hwnd)
raise TypeError('either a valid file descriptor, file name, or window handle must be supplied')
+ def __init__(self, *args, **kwargs):
+ return super(IOChannel, self).__init__()
+
def read(self, max_count=-1):
return io_channel_read(self, max_count)
else:
raise AttributeError("'%s' object has no attribute '%s'" % (self.__class__.__name__, name))
+ def __setattr__(self, name, value):
+ real_event = getattr(self, '_UNION_MEMBERS').get(self.type)
+ if real_event:
+ setattr(getattr(self, real_event), name, value)
+ else:
+ Gdk.Event.__setattr__(self, name, value)
+
+ def __repr__(self):
+ base_repr = Gdk.Event.__repr__(self).strip("><")
+ return "<%s type=%r>" % (base_repr, self.type)
+
Event = override(Event)
__all__.append('Event')
def __getitem__(self, key):
# get_value() aborts the program on an unknown key
- if key not in self:
+ if not key in self:
raise KeyError('unknown key: %r' % (key,))
return self.get_value(key).unpack()
def __setitem__(self, key, value):
# set_value() aborts the program on an unknown key
- if key not in self:
+ if not key in self:
raise KeyError('unknown key: %r' % (key,))
# determine type string of this key
except TypeError:
raise TypeError("could not parse subscript '%s' as a tree path" % path)
+ def __init__(self, *args, **kwargs):
+ super(TreePath, self).__init__()
+
def __str__(self):
return self.to_string()
def __lt__(self, other):
- return other is not None and self.compare(other) < 0
+ return not other is None and self.compare(other) < 0
def __le__(self, other):
- return other is not None and self.compare(other) <= 0
+ return not other is None and self.compare(other) <= 0
def __eq__(self, other):
- return other is not None and self.compare(other) == 0
+ return not other is None and self.compare(other) == 0
def __ne__(self, other):
return other is None or self.compare(other) != 0
iconset = Gtk.IconSet.__new__(cls)
return iconset
+ def __init__(self, *args, **kwargs):
+ return super(IconSet, self).__init__()
+
IconSet = override(IconSet)
__all__.append('IconSet')
else:
return Pango.FontDescription.__new__(cls)
+ def __init__(self, *args, **kwargs):
+ return super(FontDescription, self).__init__()
+
FontDescription = override(FontDescription)
__all__.append('FontDescription')
PyObject *args,
PyObject *kwargs)
{
+ static char *kwlist[] = { NULL };
+
+ if (!PyArg_ParseTupleAndKeywords (args, kwargs, "", kwlist)) {
+ return -1;
+ }
+
/* Don't call PyGBoxed's init, which raises an exception. */
return 0;
}
}
+/* Ignore g_value_array deprecations. Although they are deprecated,
+ * we still need to support the marshaling of them in PyGObject.
+ */
+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+
static int
pyg_value_array_from_pyobject(GValue *value,
PyObject *obj,
return 0;
}
+G_GNUC_END_IGNORE_DEPRECATIONS
+
static int
pyg_array_from_pyobject(GValue *value,
PyObject *obj)
break;
case G_TYPE_BOXED: {
PyGTypeMarshal *bm;
+ gboolean holds_value_array;
+
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ holds_value_array = G_VALUE_HOLDS(value, G_TYPE_VALUE_ARRAY);
+ G_GNUC_END_IGNORE_DEPRECATIONS
if (obj == Py_None)
g_value_set_boxed(value, NULL);
g_value_take_boxed (value, n_value);
return pyg_value_from_pyobject_with_error (n_value, obj);
}
- else if (PySequence_Check(obj) &&
- G_VALUE_HOLDS(value, G_TYPE_VALUE_ARRAY))
+ else if (PySequence_Check(obj) && holds_value_array)
return pyg_value_array_from_pyobject(value, obj, NULL);
+
else if (PySequence_Check(obj) &&
G_VALUE_HOLDS(value, G_TYPE_ARRAY))
return pyg_array_from_pyobject(value, obj);
g_value_get_pointer(value));
case G_TYPE_BOXED: {
PyGTypeMarshal *bm;
+ gboolean holds_value_array;
+
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
+ holds_value_array = G_VALUE_HOLDS(value, G_TYPE_VALUE_ARRAY);
+ G_GNUC_END_IGNORE_DEPRECATIONS
if (G_VALUE_HOLDS(value, PY_TYPE_OBJECT)) {
PyObject *ret = (PyObject *)g_value_dup_boxed(value);
} else if (G_VALUE_HOLDS(value, G_TYPE_VALUE)) {
GValue *n_value = g_value_get_boxed (value);
return pyg_value_as_pyobject(n_value, copy_boxed);
- } else if (G_VALUE_HOLDS(value, G_TYPE_VALUE_ARRAY)) {
+ } else if (holds_value_array) {
GValueArray *array = (GValueArray *) g_value_get_boxed(value);
PyObject *ret = PyList_New(array->n_values);
int i;
cls._type_register(cls.__dict__)
def _type_register(cls, namespace):
- # don't register the class if already registered
+ ## don't register the class if already registered
if '__gtype__' in namespace:
return
try:
# Python 3
from collections import UserList
+ from imp import reload
UserList # pyflakes
- with warnings.catch_warnings():
- warnings.simplefilter('ignore')
- from imp import reload
except ImportError:
# Python 2 ships that in a different module
from UserList import UserList
except AttributeError:
pass
- # AccelGroup
+ #AccelGroup
Gtk.AccelGroup.connect_group = Gtk.AccelGroup.connect
- # StatusIcon
+ #StatusIcon
Gtk.status_icon_position_menu = Gtk.StatusIcon.position_menu
Gtk.StatusIcon.set_tooltip = Gtk.StatusIcon.set_tooltip_text
test_everything.py \
test_gi.py \
test_gdbus.py \
- test_overrides.py \
+ test_import_machinery.py \
test_overrides_glib.py \
test_overrides_pango.py \
test_overrides_gdk.py \
test_everything.py \
test_gi.py \
test_gdbus.py \
- test_overrides.py \
+ test_import_machinery.py \
test_overrides_glib.py \
test_overrides_pango.py \
test_overrides_gdk.py \
except ImportError:
has_cairo = False
+#import gi
from gi.repository import GObject
from gi.repository import GLib
from gi.repository import Gio
class TestConstant(unittest.TestCase):
- def test_constant_utf8(self):
- self.assertEqual(CONSTANT_UTF8, GIMarshallingTests.CONSTANT_UTF8)
+# Blocked by https://bugzilla.gnome.org/show_bug.cgi?id=595773
+# def test_constant_utf8(self):
+# self.assertEqual(CONSTANT_UTF8, GIMarshallingTests.CONSTANT_UTF8)
def test_constant_number(self):
self.assertEqual(CONSTANT_NUMBER, GIMarshallingTests.CONSTANT_NUMBER)
self.assertEqual(struct.long_, 42)
self.assertEqual(struct.string_, 'hello')
+ def test_union_init(self):
+ self.assertRaises(TypeError, GIMarshallingTests.Union, 42)
+ self.assertRaises(TypeError, GIMarshallingTests.Union, f=42)
+
def test_union(self):
union = GIMarshallingTests.Union()
GIMarshallingTests.Object.none_inout(GIMarshallingTests.SubObject(int=42))
- @unittest.skip('https://bugzilla.gnome.org/show_bug.cgi?id=709796')
+ @unittest.expectedFailure # https://bugzilla.gnome.org/show_bug.cgi?id=709796
def test_object_full_inout(self):
# Using gimarshallingtests.c from GI versions > 1.38.0 will show this
# test as an "unexpected success" due to reference leak fixes in that file.
# not overridden
self.assertEqual(GIMarshallingTests.SubObject.__module__, 'gi.repository.GIMarshallingTests')
- self.assertEqual(GObject.InitiallyUnowned.__module__, 'gi.repository.GObject')
+ # FIXME: does not work with TEST_NAMES='test_thread test_gi.TestOverrides',
+ # it is importlib._bootstrap then
+ #self.assertEqual(GObject.InitiallyUnowned.__module__, 'gi.repository.GObject')
class TestDir(unittest.TestCase):
# -*- Mode: Python; py-indent-offset: 4 -*-
# vim: tabstop=4 shiftwidth=4 expandtab
+import sys
import unittest
import gi.overrides
# Restore the previous cache
gi.module._introspection_modules = old_modules
+
+
+class TestImporter(unittest.TestCase):
+ def test_invalid_repository_module_name(self):
+ with self.assertRaises(ImportError) as context:
+ from gi.repository import InvalidGObjectRepositoryModuleName
+ InvalidGObjectRepositoryModuleName # pyflakes
+
+ exception_string = str(context.exception)
+
+ self.assertTrue('InvalidGObjectRepositoryModuleName' in exception_string)
+
+ # The message of the custom exception in gi/importer.py is eaten in Python 2.7
+ if sys.version_info.major < 3:
+ self.assertTrue('introspection typelib' not in exception_string)
+ else:
+ self.assertTrue('introspection typelib' in exception_string)
ch.seek(2, 2) # SEEK_END
# FIXME: does not work currently
- # self.assertEqual(ch.read(2), b'n!')
+ #self.assertEqual(ch.read(2), b'n!')
# invalid whence value
self.assertRaises(ValueError, ch.seek, 0, 3)
def test_parse_args_double_dash(self):
options, args = self.parser.parse_args(
["test_option.py", "--", "-xxx"])
- # self.assertEqual(args, ["-xxx"])
+ #self.assertEqual(args, ["-xxx"])
def test_parse_args_group(self):
group = self._create_group()
self.assertEqual(event.type, Gdk.EventType.CONFIGURE)
self.assertEqual(event.send_event, 0)
+ event = Gdk.Event()
+ event.type = Gdk.EventType.SCROLL
+ self.assertRaises(AttributeError, lambda: getattr(event, 'foo_bar'))
+
+ def test_event_setattr(self):
event = Gdk.Event.new(Gdk.EventType.DRAG_MOTION)
event.x_root, event.y_root = 0, 5
+ self.assertEqual(event.dnd.x_root, 0)
+ self.assertEqual(event.dnd.y_root, 5)
self.assertEqual(event.x_root, 0)
self.assertEqual(event.y_root, 5)
- event = Gdk.Event()
- event.type = Gdk.EventType.SCROLL
- self.assertRaises(AttributeError, lambda: getattr(event, 'foo_bar'))
+ # this used to work, keep it that way
+ self.assertFalse(hasattr(event, "foo_bar"))
+ event.foo_bar = 42
+
+ def test_event_repr(self):
+ event = Gdk.Event.new(Gdk.EventType.CONFIGURE)
+ self.assertTrue("CONFIGURE" in repr(event))
def test_event_structures(self):
def button_press_cb(button, event):
self.assertEqual(func_info.get_return_type().get_tag(), GIRepository.TypeTag.VOID)
self.assertRaises(AttributeError, func_info.get_return_attribute, '_not_an_attr')
- @unittest.skip('https://bugzilla.gnome.org/show_bug.cgi?id=709462')
+ @unittest.expectedFailure # https://bugzilla.gnome.org/show_bug.cgi?id=709462
@unittest.skipUnless(has_cairo, 'Regress needs cairo')
def test_signal_info(self):
repo.require('Regress')
self.assertFalse(sig_info.true_stops_emit())
self.assertEqual(sig_info.get_flags(), sig_flags)
- @unittest.skip('https://bugzilla.gnome.org/show_bug.cgi?id=709462')
+ @unittest.expectedFailure # https://bugzilla.gnome.org/show_bug.cgi?id=709462
@unittest.skipUnless(has_cairo, 'Regress needs cairo')
def test_notify_signal_info_with_obj(self):
repo.require('Regress')
inst = Foo()
inst.my_acc_signal.connect(lambda obj: 1)
inst.my_acc_signal.connect(lambda obj: 2)
- # the value returned in the following handler will not be
- # considered, because at this point the accumulator already
- # reached its limit.
+ ## the value returned in the following handler will not be
+ ## considered, because at this point the accumulator already
+ ## reached its limit.
inst.my_acc_signal.connect(lambda obj: 3)
retval = inst.my_acc_signal.emit()
self.assertEqual(retval, 3)
inst = Foo()
inst.my_other_acc_signal.connect(self._true_handler1)
inst.my_other_acc_signal.connect(self._true_handler2)
- # the following handler will not be called because handler2
- # returns True, so it should stop the emission.
+ ## the following handler will not be called because handler2
+ ## returns True, so it should stop the emission.
inst.my_other_acc_signal.connect(self._true_handler3)
self.__true_val = None
inst.my_other_acc_signal.emit()
rv = self.obj.emit("test-gvalue", v)
self.assertEqual(rv, GObject.G_MAXINT64)
+ # implicit int64
+ # does not work, see https://bugzilla.gnome.org/show_bug.cgi?id=683775
+ #rv = self.obj.emit("test-gvalue", GObject.G_MAXINT64)
+ #self.assertEqual(rv, GObject.G_MAXINT64)
+
# explicit uint64
v = GObject.Value(GObject.TYPE_UINT64, GObject.G_MAXUINT64)
rv = self.obj.emit("test-gvalue", v)
self.assertEqual(rv, GObject.G_MAXUINT64)
- @unittest.expectedFailure # https://bugzilla.gnome.org/show_bug.cgi?id=705291
- def test_gvalue_implicit_int64(self):
- # implicit int64
- rv = self.obj.emit("test-gvalue", GObject.G_MAXINT64)
- self.assertEqual(rv, GObject.G_MAXINT64)
-
# implicit uint64
- rv = self.obj.emit("test-gvalue", GObject.G_MAXUINT64)
- self.assertEqual(rv, GObject.G_MAXUINT64)
+ # does not work, see https://bugzilla.gnome.org/show_bug.cgi?id=683775
+ #rv = self.obj.emit("test-gvalue", GObject.G_MAXUINT64)
+ #self.assertEqual(rv, GObject.G_MAXUINT64)
def test_gvalue_ret(self):
self.assertEqual(self.obj.emit("test-gvalue-ret", GObject.TYPE_INT),
@GObject.SignalOverride
def notify(self, *args, **kargs):
self.overridden_closure_called = True
+ #GObject.GObject.notify(self, *args, **kargs)
def on_notify(self, obj, prop):
self.notify_called = True
obj = self.DecoratedOverride()
obj.connect("notify", obj.on_notify)
self.assertEqual(obj.value, 0)
+ #obj.notify.emit()
obj.value = 1
self.assertEqual(obj.value, 1)
self.assertTrue(obj.overridden_closure_called)
if (!PyArg_ParseTuple(args, "O", &obj))
return NULL;
+ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
g_value_init(value, G_TYPE_VALUE_ARRAY);
+ G_GNUC_END_IGNORE_DEPRECATIONS
+
if (pyg_value_from_pyobject(value, obj)) {
PyErr_SetString(PyExc_TypeError, "Could not convert to GValueArray");
return NULL;