| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
When we create a custom GLib.Source instance and attach it to a MainContext
the methods will be called by the context. In case the Python wrapper
gets freed this means the object used in the callbacks is no longer valid
and things crash.
To prevent this case simply destroy the source in case it gets deallocated
so that its methods will no longer be called after that. This means the
user has to make sure that the object stays alive, like now, but without
having crashes if one doesn't.
|
| |
|
|
|
|
| |
This reverts commit a506d5e3c64321c43a4ce7c2a72ca8d36e985999.
|
|
|
|
| |
This reverts commit daefdfa3e4dc97b4ae38250358d722f09764cc9b.
|
|
|
|
|
|
|
|
|
|
|
| |
pytest will just import the files passed to it and try to run tests.
Since we need to run some setup code convert the tests directory to
a Python package and do the initialization in __init__.py. This makes
the init code (env vars, typelib search path, dbus) always run when
something from the package gets imported.
python3 setup.py build_tests # build pygobject and tests
py.test-3 tests/test_gi.py # run tests in test_gi.py only
|
|
|
|
| |
This reverts commit 85175047e66dfc0c0263eac91d8056a95d0a60a0.
|
|
|
|
|
|
|
|
|
|
| |
* Instead of waiting for a fixed time, use a timeout and stop the main
loop right after the test has succeeded.
* Replace time.sleep to sync processes with os.pipe communication
* Chain idle sources instead of using multiple timeout sources
* Replace sleeps with unbufferd communication
https://bugzilla.gnome.org/show_bug.cgi?id=698548
|
|
|
|
|
|
|
| |
* Skip all tests which fail, crash or hang.
* Disable D-Bus in case dbus-run-session is not available.
https://bugzilla.gnome.org/show_bug.cgi?id=780396
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This silences glib warnings which are due to testing
of error handling, deprecation warnings which we ignore
since we want to continue testing deprecated code and
other error output of code which is supposed to fail.
To reduce code duplication and make things easier
this introduces a shared helper module containing
various context managers and decorators which allow
testing and silencing of warnings and errors.
https://bugzilla.gnome.org/show_bug.cgi?id=751156
|
|
|
|
|
|
|
|
|
|
|
| |
In case the test explicitly tests the deprecated attribute
silence the resulting warnings.
Instead of replacing GObject.PARAM_READWRITE with
GObject.ParamFlags.READWRITE use (READABLE | WRITABLE)
to not depend on a newer glib version.
https://bugzilla.gnome.org/show_bug.cgi?id=743514
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Change pygi_boxed_new() to accept "copy_boxed" instead of "free_on_dealloc".
This changes memory management so the PyGIBoxed wrapper owns the boxed
pointer given to it. Use __del__ instead of dealloc for freeing the boxed
memory. This is needed for edge cases where objects like GSource can
trigger the finalized callback during de-alloc, resulting in the PyObjects
references counts being manipulated and triggering a re-entrant de-alloc.
Add hack to keep Gtk.TreeIter.do_iter_next/previous implementations working
which rely on pass-by-reference.
See also: https://bugzilla.gnome.org/show_bug.cgi?id=734465
https://bugzilla.gnome.org/show_bug.cgi?id=722899
https://bugzilla.gnome.org/show_bug.cgi?id=726999
|
|
|
|
|
|
| |
Add test showing memory problems with sub-classes of GLib.Source.
https://bugzilla.gnome.org/show_bug.cgi?id=722387
|
|
|
|
|
|
|
|
| |
Silence new critical coming from g_source_remove on non-existing sources.
This function still returns False, but we need to silence the new critical
so the test suite doesn't fail. See bug 710724.
https://bugzilla.gnome.org/show_bug.cgi?id=710978
|
|
|
|
|
|
|
| |
Add variable args and keyword args to the GLib.Source.__new__
method to support sub-classes which want to implement __init__.
https://bugzilla.gnome.org/show_bug.cgi?id=707904
|
|
|
|
|
|
|
|
| |
In GLib.Source.__del__(), manually unref the source if we are a custom Source.
As we use a static binding to create it, the GI part won't unref it for us,
leading to finalize() method not being called and the GSource object leaking.
https://bugzilla.gnome.org/show_bug.cgi?id=510511
|
|
|
|
|
|
|
|
|
| |
Re-fix the acceptance of priority as first argument for idle_add(),
io_add_watch() and timeout_add(), as that is the real GLib API. Ensure that
this keeps supporting the backwards compatible API with supplying multiple user
data arguments.
https://bugzilla.gnome.org/show_bug.cgi?id=687047
|
|
|
|
|
|
| |
DeprecationWarning is not shown by default, and is thus rather useless for
developers. Use a custom PyGIDeprecationWarning class and derive it from
RuntimeWarning to make it visible.
|
|
|
|
|
|
|
| |
Use the introspected constants instead, which are identical. Add backwards
compatible aliases.
These constants are covered by tests/test_iochannel.py.
|
|
|
|
|
|
| |
Use the GLib functions through GI instead. Add overrides to ensure that default
arguments continue to work as before, and that callbacks are called without an
userdata argument if it wasn't specified.
|
|
|
|
|
|
|
|
|
| |
There is a potential to treat the priority as user data in a call like
"GLib.idle_add(cb, GLib.PRIORITY_HIGH)". The current static bindings force
using a keyword argument for the priority (but silently ignore it if you
specify both userdata and priority as a positional argument).
Test the correct handling of priority as well.
|
| |
|
|
|
|
|
| |
This is implicitly spread over various test cases, but let's test it explicitly
to ensure that the behaviour stays consistent when moving this to GI.
|
|
|
|
|
| |
Stop mixing camel case and underline naming, use the latter consistently
in all tests.
|
|
|
|
|
| |
This method has been deprecated in GLib long ago. We have a workaround
implementation using GLib.get_real_time(), but eventually this should go away.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
glib's MainLoop and MainContext are fully introspectable these days, so remove
our static bindings. This reduces our code, as well enables GLib API which
hasn't been available through the static bindings before.
This also requires dropping our custom static types for GLib Source, Timeout,
and Idle. The latter two work fine with introspection and just need tiny
overrides for a backwards compatible API. g_source_new() is not introspectable,
though, so we need to keep our static wrappers for that. Move them from
gi/_glib/pygsource.c to gi/pygi-source.c, so that it can use the GI API.
Note that gi/_glib/pygsource.[hc] is still required for the static PollFD type
which is used by the static IOChannel binding. Once the latter goes away,
PollFD can be dropped as well.
https://bugzilla.gnome.org/show_bug.cgi?id=686443
|
|
|
|
|
|
|
| |
These cover the remaining static API and behaviour, so that we have good
regression tests for converting them to GI.
See https://bugzilla.gnome.org/show_bug.cgi?id=686443
|
|
|
|
|
|
| |
GSource IDs are unsigned, so we must use 'I' for parsing then, not 'i'.
https://bugzilla.gnome.org/show_bug.cgi?id=684526
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
PyGObject has established the assumption that the destruction of a GLib.Source
Python object does not destroy the actual GSource, as shown in
TestSource.setup_timeout(), TestTimeout.test504337(), and
https://bugzilla.gnome.org/show_bug.cgi?id=504337.
So we need to explicitly destroy our MySource and Idle objects after using
them, as their callbacks always return True and we do not want them to spill
over into other tests.
Also fix the assertions to actually verify that MySources' callback was callied
(pos > 0, not pos >= 0), and use the unittest comparison API instead of a
simple assert statement.
https://bugzilla.gnome.org/show_bug.cgi?id=686627
|
|
|
|
|
|
| |
Based on original patch from Bryan Silverthorn.
https://bugzilla.gnome.org/show_bug.cgi?id=524719
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=672627
|
|
|
|
|
|
| |
And add a target to make check that runs pyflakes.
https://bugzilla.gnome.org/show_bug.cgi?id=672578
|
|
|
|
| |
https://bugzilla.gnome.org/show_bug.cgi?id=642048
|
|
|
|
|
|
|
|
|
|
|
| |
* for PyGObject 3 we want to discourage the use of legacy
interfaces
* Using interfaces like from gi.repository import GObject makes
sure that the internal _gobject module is loaded and not
PyGObject 2's gobject module which would cause the application
to not work correctly
https://bugzilla.gnome.org/show_bug.cgi?id=642048
|
|
|
|
|
|
|
|
|
| |
* add a compat helper that should only be used by tests
* fix long notation to use the compat helper instead
* add parens to print statements
* use compatable try/except pattern
https://bugzilla.gnome.org/show_bug.cgi?id=615872
|
|
|
|
|
|
|
|
|
| |
To run select tests, use for instance:
% make check TEST_NAMES='test_everything test_gi.TestConstant'
It works with check.gdb and check.valgrind too.
https://bugzilla.gnome.org/show_bug.cgi?id=625488
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2008-07-26 Johan Dahlin <johan@gnome.org>
* tests/common.py:
* tests/test_conversion.py:
* tests/test_enum.py:
* tests/test_interface.py:
* tests/test_option.py:
* tests/test_source.py:
* tests/test_subprocess.py:
* tests/test_subtype.py:
* tests/test_thread.py:
* tests/test_unknown.py:
Run pyflakes on the testsuite, remove unused imports
and reorganize others.
svn path=/trunk/; revision=859
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2008-07-26 Johan Dahlin <johan@gnome.org>
* glib/glibmodule.c (pyglib_register_constants), (init_glib):
* gobject/__init__.py:
* gobject/gobjectmodule.c (init_gobject):
Move over glib constants to gobject
* tests/test_gio.py:
* tests/test_mainloop.py:
* tests/test_source.py:
* tests/test_subprocess.py:
* tests/test_thread.py:
Update tests to refer to glib when appropriate
svn path=/trunk/; revision=858
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
2008-07-14 Johan Dahlin <johan@gnome.org>
Bug 504337 - crash bug in gobject.Timeout and gobject.Idle
* gobject/pygsource.c:
* tests/test_source.py:
Fix crash in Timeout and Idle, patch by Bryan Silverthorn.
svn path=/trunk/; revision=799
|
|
|
|
|
|
|
|
|
|
|
| |
2008-04-08 Johan Dahlin <jdahlin@async.com.br>
* gobject/pygsource.c:
* tests/test_source.py:
Unbreak Source.prepare (#523075, Bryan Silverthorn)
svn path=/trunk/; revision=766
|
|
* gobject/pygobject-private.h
* gobject/gobjectmodule.c
* gobject/Makefile.am
* gobject/pygsource.c: GSource wrapper, allows for pure python
GSource implementations, as well as objectifying Idle and Timeout
sources.
* tests/Makefile.am
* tests/test_source.py: Add test for the above.
* gobject/gobjectmodule.c: timeout_add should take an explicit
unsigned value. Also wrap g_get_current_time and g_main_depth.
* gobject/pygiochannel.c (py_io_channel_write_chars): fix thread
unblock/block logic.
|