+commit c65efcb0bb4a73c9fb1ffa10225795adc489a081
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Sat Feb 10 13:22:17 2018 +0100
+
+ release
+
+ NEWS | 11 +++++++++++
+ docs/conf.py | 1 +
+ 2 files changed, 12 insertions(+)
+
+commit 11de6f55f48447325325ec2f334af5576d12e2ed
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Sat Feb 10 11:37:55 2018 +0100
+
+ tests: switch to pytest as the default test runner. See #153
+
+ The TEST_NAMES env var gets translated to work with the pytest syntax
+ (foo.py::class::method).
+
+ Rename one class which triggers a pytest warning because it starts
+ with
+ "Test" but isn't one.
+
+ Remove erroring out on Python warnings as pytest triggers some
+ deprecation warnings by default.
+
+ .gitignore | 2 ++
+ .gitlab-ci/test-docker.sh | 2 +-
+ docs/devguide/building_testing.rst | 9 +++++++++
+ docs/devguide/dev_environ.rst | 6 ++++--
+ tests/Makefile.am | 2 +-
+ tests/runtests.py | 16 +++++++++-------
+ tests/test_generictreemodel.py | 16 ++++++++--------
+ 7 files changed, 34 insertions(+), 19 deletions(-)
+
+commit 9a9bb732752e7bec42a1c13f080b37536876e3e0
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Sat Feb 10 11:16:49 2018 +0100
+
+ tests: set DBUS_SESSION_BUS_ADDRESS to some invalid value to
+ disable dbus
+
+ While keepig it empty works on Linux, on Windows setting an invalid
+ value is needed to disable dbus.
+
+ tests/runtests.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+commit 64b02e3017b50a17a087ee821522a1cb8e066f27
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Fri Feb 9 17:06:52 2018 +0100
+
+ tests: remove locale test for uppercasing C names
+
+ Someone on IRC had problems running the test suite, and that's not
+ the first
+ time, so remove it for now (added in 63c7f17c2248)
+
+ The locale generation adds extra dependencies and only works on Linux,
+ and while the test does something useful it complicates things
+ too much.
+
+ We need to find a better way (in Python if possible) to test for
+ locale
+ dependend upper()/lower().
+
+ MANIFEST.in | 2 +-
+ tests/Makefile.am | 1 -
+ tests/te_ST@nouppera | 50
+ --------------------------------------------------
+ tests/test_gi.py | 31 -------------------------------
+ 4 files changed, 1 insertion(+), 83 deletions(-)
+
+commit d9516e8dc32db9494139a733ae3a535d2f89c6e1
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Fri Feb 9 14:12:20 2018 +0100
+
+ tests: disable dbus tests on Windows/macOS
+
+ dbus-daemon is available in MSYS2 unlike dbus-run-session but the
+ tests fail. Disable dbus tests on Windows/macOS to restore the
+ old behaviour for now.
+
+ tests/runtests.py | 3 +++
+ 1 file changed, 3 insertions(+)
+
+commit 1e28b03b1562c030a956ed82337eaacfa38c304e
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Thu Feb 8 17:10:21 2018 +0100
+
+ tests: move dbus session bus handling into runtests.py
+
+ This allows us to remove code duplication in autotools/distutils.
+
+ This also fixes the noisy dbus output during tests because
+ dbus-run-session
+ forwarded dbus logging output to stderr.
+
+ .gitlab-ci/Dockerfile | 1 -
+ .gitlab-ci/run-docker.sh | 0
+ setup.py | 14 ++------------
+ tests/Makefile.am | 10 +++-------
+ tests/runtests.py | 27 +++++++++++++++++++++++++--
+ 5 files changed, 30 insertions(+), 22 deletions(-)
+
+commit 095388a7c83dbffbe042f842789285f63996fc11
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Thu Feb 8 15:38:24 2018 +0100
+
+ gitlab-ci: use pyenv in docker instead of the deadsnakes PPA
+
+ deadsnakes only provides packages for Ubuntu LTS versions and doesn't
+ include versions present in that Ubuntu version.
+ With Ubuntu zesty this happened to work, but now that that's EOL
+ we have to switch to artful and no longer have a Python 3.5 available.
+
+ Instead switch to using pyenv in docker and compiler our own Python
+ versions. This should make it easier to swtich distros in the future.
+
+ Also adds a run-docker.sh script which builds the image and
+ runs it with the git repo mounted. This should make local testing
+ easier in the future.
+
+ .gitlab-ci.yml | 12 +++++++---
+ .gitlab-ci/Dockerfile | 60
+ ++++++++++++++++++++++++++++-------------------
+ .gitlab-ci/run-docker.sh | 7 ++++++
+ .gitlab-ci/test-docker.sh | 11 +++++----
+ 4 files changed, 58 insertions(+), 32 deletions(-)
+
+commit 7bc20fe2d1225bebb2f4ec1faabf6a70e4e5a4e7
+Author: Mikhail Fludkov <misha@pexip.com>
+Date: Thu Feb 8 12:49:01 2018 +0100
+
+ tests: Make tests run without Gtk/Gdk installed
+
+ Python evaluates the code inside @unittest.skipIf decorator during
+ import time. Because Gtk is not installed it crashes while evaluating
+ 'Gtk._version' where Gtk=None.
+
+ tests/test_ossig.py | 10 ++++++---
+ tests/test_overrides_gdk.py | 17 +++++++--------
+ tests/test_overrides_gtk.py | 50
+ +++++++++++++++++++++++----------------------
+ 3 files changed, 42 insertions(+), 35 deletions(-)
+
+commit d371fd77d33c2987cc450bd68ce4ee4835e09bd8
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Thu Feb 8 09:02:37 2018 +0100
+
+ Revert "to-py-struct: don't copy the boxed if we are the sole owner
+ of the wrapper"
+
+ This reverts commit a4a68b3c7a4bb64c71e1bdbe52ede109b6bcd0bb.
+
+ This was wrong. In the context of a boxed return value we also have
+ only one
+ ref but it doesn't get freed after.
+
+ We could decide this based on PYGI_CALLING_CONTEXT_IS_FROM_C from
+ the callable cache,
+ but let's leave that for now.
+
+ gi/pygi-struct-marshal.c | 11 ++---------
+ tests/test_everything.py | 2 --
+ 2 files changed, 2 insertions(+), 11 deletions(-)
+
+commit 024ac583538976330b429b9b203d412fec0426e3
+Author: Mikhail Fludkov <fludkov.me@gmail.com>
+Date: Tue Feb 6 15:24:17 2018 +0100
+
+ tests: test_boxed_c_wrapper failing tests
+
+ Introduced here 1ec8d58
+
+ setup.py | 2 ++
+ tests/Makefile.am | 8 +++++---
+ tests/regressextra.c | 51
+ ++++++++++++++++++++++++++++++++++++++++++++++++
+ tests/regressextra.h | 17 ++++++++++++++++
+ tests/test_everything.py | 31 +++++++++++++++++++++++++++++
+ 5 files changed, 106 insertions(+), 3 deletions(-)
+
+commit ee79fef18748ad660d3a0471ed9a18ea11410849
+Author: Christoph Reiter <reiter.christoph@gmail.com>
+Date: Wed Feb 7 11:55:54 2018 +0100
+
+ version bump
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
commit 7f678500a9edad6218911dc7d81e0bc057c58326
Author: Christoph Reiter <reiter.christoph@gmail.com>
Date: Wed Feb 7 11:35:13 2018 +0100
recursive-include examples *.py *.am *.png *.css *.ui *.gif *.gresource *.jpg *.xml
recursive-include gi *.am *.h
recursive-include pygtkcompat *.am
-recursive-include tests *.py *.c *.h *.xml *.supp *nouppera *.am
+recursive-include tests *.py *.c *.h *.xml *.supp *.am
recursive-include docs *.rst *.svg LICENSE *.ico *.png *.css *.py *.dia Makefile
recursive-include .gitlab-ci *.sh *.rst Dockerfile
+3.27.3 - 2018-02-10
+-------------------
+
+* Fix a 3.27.2 regression where functions return invalid boxed values. :mr:`16`
+ (thanks to :user:`Mikhail Fludkov <fludkov.me>` for providing a test)
+* tests: Make tests run without Gtk/Gdk installed. :mr:`17`
+ (:user:`Mikhail Fludkov <fludkov.me>`)
+* tests: Remove dependency on ``localedef``. :commit:`64b02e301`
+* tests: Require/Use pytest. :mr:`20` :issue:`153`
+
+
3.27.2 - 2018-02-07
-------------------
Metadata-Version: 1.0
Name: PyGObject
-Version: 3.27.2
+Version: 3.27.3
Summary: Python bindings for GObject Introspection
Home-page: https://pygobject.readthedocs.io
Author: James Henstridge
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for pygobject 3.27.2.
+# Generated by GNU Autoconf 2.69 for pygobject 3.27.3.
#
# 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.27.2'
-PACKAGE_STRING='pygobject 3.27.2'
+PACKAGE_VERSION='3.27.3'
+PACKAGE_STRING='pygobject 3.27.3'
PACKAGE_BUGREPORT='http://bugzilla.gnome.org/enter_bug.cgi?product=pygobject'
PACKAGE_URL='https://wiki.gnome.org/Projects/PyGObject/'
# 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.27.2 to adapt to many kinds of systems.
+\`configure' configures pygobject 3.27.3 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.27.2:";;
+ short | recursive ) echo "Configuration of pygobject 3.27.3:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-pygobject configure 3.27.2
+pygobject configure 3.27.3
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.27.2, which was
+It was created by pygobject $as_me 3.27.3, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
PYGOBJECT_MINOR_VERSION=27
-$as_echo "#define PYGOBJECT_MICRO_VERSION 2" >>confdefs.h
+$as_echo "#define PYGOBJECT_MICRO_VERSION 3" >>confdefs.h
-PYGOBJECT_MICRO_VERSION=2
+PYGOBJECT_MICRO_VERSION=3
ac_config_headers="$ac_config_headers config.h"
# Define the identity of the package.
PACKAGE='pygobject'
- VERSION='3.27.2'
+ VERSION='3.27.3'
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.27.2, which was
+This file was extended by pygobject $as_me 3.27.3, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
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.27.2
+pygobject config.status 3.27.3
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, 27)
-m4_define(pygobject_micro_version, 2)
+m4_define(pygobject_micro_version, 3)
m4_define(pygobject_version, pygobject_major_version.pygobject_minor_version.pygobject_micro_version)
dnl versions of packages we require ...
extlinks = {
'bzbug': ('https://bugzilla.gnome.org/show_bug.cgi?id=%s', 'bz#'),
'issue': ('https://gitlab.gnome.org/GNOME/pygobject/issues/%s', 'issue#'),
+ 'commit': ('https://gitlab.gnome.org/GNOME/pygobject/commit/%s', 'commit#'),
'mr': (
'https://gitlab.gnome.org/GNOME/pygobject/merge_requests/%s', 'mr#'),
'user': ('https://gitlab.gnome.org/%s', ''),
Building & Testing
==================
+To pass extra arguments to pytest you can set "PYTEST_ADDOPTS":
+
+.. code:: shell
+
+ # don't hide stdout
+ export PYTEST_ADDOPTS="-s"
+ python3 setup.py test
+
+
Using Autotools
---------------
.. code:: console
sudo apt build-dep pygobject
- sudo apt install autoconf-archive
+ sudo apt install autoconf-archive python3-pytest python3-flake8
git clone https://gitlab.gnome.org/GNOME/pygobject.git
cd pygobject
./autogen.sh
pacman -S --needed --noconfirm base-devel mingw-w64-i686-toolchain git \
mingw-w64-i686-python3 mingw-w64-i686-python3-cairo \
mingw-w64-i686-gobject-introspection mingw-w64-i686-gtk3 \
- mingw-w64-i686-libffi autoconf-archive
+ mingw-w64-i686-libffi autoconf-archive mingw-w64-i686-python3-pytest \
+ mingw-w64-i686-python3-pip
+ pip3 install --user flake8
git clone https://gitlab.gnome.org/GNOME/pygobject.git
cd pygobject
./autogen.sh
gpointer data,
gboolean was_processed)
{
- PyGIBoxed *boxed;
-
- if (arg_cache->transfer == GI_TRANSFER_NOTHING) {
- boxed = (PyGIBoxed *) cleanup_data;
- /* If we are the sole owner of the wrapper it will be freed after this
- * anyway, so no need to copy the wrapped boxed. */
- if (Py_REFCNT (boxed) > 1)
- _pygi_boxed_copy_in_place (boxed);
- }
+ if (arg_cache->transfer == GI_TRANSFER_NOTHING)
+ _pygi_boxed_copy_in_place ((PyGIBoxed *) cleanup_data);
}
static gboolean
name='libregress',
sources=[
os.path.join(gi_tests_dir, "regress.c"),
+ os.path.join(tests_dir, "regressextra.c"),
],
include_dirs=[
gi_tests_dir,
],
depends=[
os.path.join(gi_tests_dir, "regress.h"),
+ os.path.join(tests_dir, "regressextra.h"),
],
)
add_ext_pkg_config_dep(ext, compiler.compiler_type, "glib-2.0")
env = os.environ.copy()
env.pop("MSYSTEM", None)
- pre_args = []
- try:
- subprocess.check_call(["dbus-run-session", "--", "true"])
- except (EnvironmentError, subprocess.CalledProcessError):
- # Spawning a bus failed, disable dbus instead of inheriting
- # the user one
- env["DBUS_SESSION_BUS_ADDRESS"] = ""
- else:
- pre_args = ["dbus-run-session", "--"]
-
tests_dir = os.path.join(get_script_dir(), "tests")
- subprocess.check_call(pre_args + [
+ subprocess.check_call([
sys.executable,
os.path.join(tests_dir, "runtests.py"),
], env=env)
if not env.get("TEST_NAMES"):
env["TEST_NAMES"] = "compat_test_pygtk"
- subprocess.check_call(pre_args + [
+ subprocess.check_call([
sys.executable,
os.path.join(tests_dir, "runtests.py"),
], env=env)
test_ltlibraries += libregress.la
test_typelibs += Regress-1.0.typelib
nodist_libregress_la_SOURCES = $(GI_DATADIR)/tests/regress.c $(GI_DATADIR)/tests/regress.h
+dist_libregress_la_SOURCES = $(srcdir)/regressextra.c $(srcdir)/regressextra.h
# We don't control the source so don't pass WARN_CFLAGS etc
if ENABLE_CAIRO
-libregress_la_CFLAGS = $(GIO_CFLAGS) $(CAIRO_CFLAGS)
+libregress_la_CFLAGS = $(GIO_CFLAGS) $(CAIRO_CFLAGS) -I$(GI_DATADIR)/tests
libregress_la_LIBADD = $(GIO_LIBS) $(CAIRO_LIBS)
else
-libregress_la_CFLAGS = $(GIO_CFLAGS) -D_GI_DISABLE_CAIRO
+libregress_la_CFLAGS = $(GIO_CFLAGS) -D_GI_DISABLE_CAIRO -I$(GI_DATADIR)/tests
libregress_la_LIBADD = $(GIO_LIBS) $(CAIRO_LIBS)
endif
libregress_la_LDFLAGS = $(common_ldflags)
--library=libregress.la \
--libtool="$(top_builddir)/libtool" \
--output $@ \
- $(nodist_libregress_la_SOURCES)
+ $(nodist_libregress_la_SOURCES) \
+ $(dist_libregress_la_SOURCES)
Regress-1.0.typelib: Regress-1.0.gir Makefile
$(AM_V_GEN) $(INTROSPECTION_COMPILER) $< -o $@
test-floating.h \
test-thread.h \
test-unknown.h \
- te_ST@nouppera \
org.gnome.test.gschema.xml \
test_cairo.py \
test_error.py \
MSYSTEM= \
TESTS_BUILDDIR=$(builddir)
-# if dbus-run-session is available, use it, otherwise disable DBUS
-check-local:
- DBUS_ENV=$$(dbus-run-session true && echo "dbus-run-session --" || echo "DBUS_SESSION_BUS_ADDRESS=.") $(MAKE) check.real
-
# pygtkcompat tests need to be run in a separate process as they
# clobber global name space
-check.real: $(target_libraries) $(test_typelibs) gschemas.compiled
- $(RUN_TESTS_ENV_VARS) $(EXTRA_ENV) $(DBUS_ENV) $(EXEC_NAME) $(PYTHON) -Wd $(srcdir)/runtests.py; rc=$$?; \
- [ "$$rc" -ne 0 ] || [ -n "$$TEST_NAMES" ] || { TEST_NAMES=compat_test_pygtk $(RUN_TESTS_ENV_VARS) $(EXTRA_ENV) $(DBUS_ENV) $(EXEC_NAME) $(PYTHON) -Wd -Werror::PendingDeprecationWarning -Werror::DeprecationWarning -Werror::RuntimeWarning $(srcdir)/runtests.py; rc=$$?; }; \
+check-local: $(target_libraries) $(test_typelibs) gschemas.compiled
+ $(RUN_TESTS_ENV_VARS) $(EXTRA_ENV) $(EXEC_NAME) $(PYTHON) -Wd $(srcdir)/runtests.py; rc=$$?; \
+ [ "$$rc" -ne 0 ] || [ -n "$$TEST_NAMES" ] || { TEST_NAMES=compat_test_pygtk $(RUN_TESTS_ENV_VARS) $(EXTRA_ENV) $(EXEC_NAME) $(PYTHON) -Wd $(srcdir)/runtests.py; rc=$$?; }; \
exit $$rc
check.gdb:
@ENABLE_CAIRO_FALSE@ $(am__DEPENDENCIES_1)
@ENABLE_CAIRO_TRUE@libregress_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
@ENABLE_CAIRO_TRUE@ $(am__DEPENDENCIES_1)
+dist_libregress_la_OBJECTS = libregress_la-regressextra.lo
nodist_libregress_la_OBJECTS = libregress_la-regress.lo
-libregress_la_OBJECTS = $(nodist_libregress_la_OBJECTS)
+libregress_la_OBJECTS = $(dist_libregress_la_OBJECTS) \
+ $(nodist_libregress_la_OBJECTS)
libregress_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(libregress_la_CFLAGS) \
$(CFLAGS) $(libregress_la_LDFLAGS) $(LDFLAGS) -o $@
am__v_CCLD_1 =
SOURCES = $(dist_libgimarshallingtests_la_SOURCES) \
$(nodist_libgimarshallingtests_la_SOURCES) \
- $(nodist_libregress_la_SOURCES) $(testhelper_la_SOURCES)
-DIST_SOURCES = $(dist_libgimarshallingtests_la_SOURCES) \
+ $(dist_libregress_la_SOURCES) $(nodist_libregress_la_SOURCES) \
$(testhelper_la_SOURCES)
+DIST_SOURCES = $(dist_libgimarshallingtests_la_SOURCES) \
+ $(dist_libregress_la_SOURCES) $(testhelper_la_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
libgimarshallingtests_la_LDFLAGS = $(common_ldflags)
libgimarshallingtests_la_LIBADD = $(GLIB_LIBS)
nodist_libregress_la_SOURCES = $(GI_DATADIR)/tests/regress.c $(GI_DATADIR)/tests/regress.h
-@ENABLE_CAIRO_FALSE@libregress_la_CFLAGS = $(GIO_CFLAGS) -D_GI_DISABLE_CAIRO
+dist_libregress_la_SOURCES = $(srcdir)/regressextra.c $(srcdir)/regressextra.h
+@ENABLE_CAIRO_FALSE@libregress_la_CFLAGS = $(GIO_CFLAGS) -D_GI_DISABLE_CAIRO -I$(GI_DATADIR)/tests
# We don't control the source so don't pass WARN_CFLAGS etc
-@ENABLE_CAIRO_TRUE@libregress_la_CFLAGS = $(GIO_CFLAGS) $(CAIRO_CFLAGS)
+@ENABLE_CAIRO_TRUE@libregress_la_CFLAGS = $(GIO_CFLAGS) $(CAIRO_CFLAGS) -I$(GI_DATADIR)/tests
@ENABLE_CAIRO_FALSE@libregress_la_LIBADD = $(GIO_LIBS) $(CAIRO_LIBS)
@ENABLE_CAIRO_TRUE@libregress_la_LIBADD = $(GIO_LIBS) $(CAIRO_LIBS)
libregress_la_LDFLAGS = $(common_ldflags)
test-floating.h \
test-thread.h \
test-unknown.h \
- te_ST@nouppera \
org.gnome.test.gschema.xml \
test_cairo.py \
test_error.py \
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgimarshallingtests_la-gimarshallingtests.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgimarshallingtests_la-gimarshallingtestsextra.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libregress_la-regress.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libregress_la-regressextra.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testhelper_la-test-floating.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testhelper_la-test-thread.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testhelper_la-test-unknown.Plo@am__quote@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgimarshallingtests_la_CFLAGS) $(CFLAGS) -c -o libgimarshallingtests_la-gimarshallingtests.lo `test -f '$(GI_DATADIR)/tests/gimarshallingtests.c' || echo '$(srcdir)/'`$(GI_DATADIR)/tests/gimarshallingtests.c
+libregress_la-regressextra.lo: $(srcdir)/regressextra.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libregress_la_CFLAGS) $(CFLAGS) -MT libregress_la-regressextra.lo -MD -MP -MF $(DEPDIR)/libregress_la-regressextra.Tpo -c -o libregress_la-regressextra.lo `test -f '$(srcdir)/regressextra.c' || echo '$(srcdir)/'`$(srcdir)/regressextra.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libregress_la-regressextra.Tpo $(DEPDIR)/libregress_la-regressextra.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(srcdir)/regressextra.c' object='libregress_la-regressextra.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libregress_la_CFLAGS) $(CFLAGS) -c -o libregress_la-regressextra.lo `test -f '$(srcdir)/regressextra.c' || echo '$(srcdir)/'`$(srcdir)/regressextra.c
+
libregress_la-regress.lo: $(GI_DATADIR)/tests/regress.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libregress_la_CFLAGS) $(CFLAGS) -MT libregress_la-regress.lo -MD -MP -MF $(DEPDIR)/libregress_la-regress.Tpo -c -o libregress_la-regress.lo `test -f '$(GI_DATADIR)/tests/regress.c' || echo '$(srcdir)/'`$(GI_DATADIR)/tests/regress.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libregress_la-regress.Tpo $(DEPDIR)/libregress_la-regress.Plo
--library=libregress.la \
--libtool="$(top_builddir)/libtool" \
--output $@ \
- $(nodist_libregress_la_SOURCES)
+ $(nodist_libregress_la_SOURCES) \
+ $(dist_libregress_la_SOURCES)
Regress-1.0.typelib: Regress-1.0.gir Makefile
$(AM_V_GEN) $(INTROSPECTION_COMPILER) $< -o $@
clean-local:
rm -f $(target_libraries) file.txt~
-# if dbus-run-session is available, use it, otherwise disable DBUS
-check-local:
- DBUS_ENV=$$(dbus-run-session true && echo "dbus-run-session --" || echo "DBUS_SESSION_BUS_ADDRESS=.") $(MAKE) check.real
-
# pygtkcompat tests need to be run in a separate process as they
# clobber global name space
-check.real: $(target_libraries) $(test_typelibs) gschemas.compiled
- $(RUN_TESTS_ENV_VARS) $(EXTRA_ENV) $(DBUS_ENV) $(EXEC_NAME) $(PYTHON) -Wd $(srcdir)/runtests.py; rc=$$?; \
- [ "$$rc" -ne 0 ] || [ -n "$$TEST_NAMES" ] || { TEST_NAMES=compat_test_pygtk $(RUN_TESTS_ENV_VARS) $(EXTRA_ENV) $(DBUS_ENV) $(EXEC_NAME) $(PYTHON) -Wd -Werror::PendingDeprecationWarning -Werror::DeprecationWarning -Werror::RuntimeWarning $(srcdir)/runtests.py; rc=$$?; }; \
+check-local: $(target_libraries) $(test_typelibs) gschemas.compiled
+ $(RUN_TESTS_ENV_VARS) $(EXTRA_ENV) $(EXEC_NAME) $(PYTHON) -Wd $(srcdir)/runtests.py; rc=$$?; \
+ [ "$$rc" -ne 0 ] || [ -n "$$TEST_NAMES" ] || { TEST_NAMES=compat_test_pygtk $(RUN_TESTS_ENV_VARS) $(EXTRA_ENV) $(EXEC_NAME) $(PYTHON) -Wd $(srcdir)/runtests.py; rc=$$?; }; \
exit $$rc
check.gdb:
--- /dev/null
+#include "regress.h"
+#include "regressextra.h"
+
+#include <glib-object.h>
+
+struct _RegressTestBoxedCWrapper
+{
+ RegressTestBoxedC * cptr;
+};
+
+RegressTestBoxedCWrapper *
+regress_test_boxed_c_wrapper_new (void)
+{
+ RegressTestBoxedCWrapper *boxed;
+ boxed = g_slice_new (RegressTestBoxedCWrapper);
+ boxed->cptr = regress_test_boxed_c_new ();
+ return boxed;
+}
+
+RegressTestBoxedCWrapper *
+regress_test_boxed_c_wrapper_copy (RegressTestBoxedCWrapper *self)
+{
+ RegressTestBoxedCWrapper *ret_boxed;
+ ret_boxed = g_slice_new (RegressTestBoxedCWrapper);
+ ret_boxed->cptr = g_boxed_copy (regress_test_boxed_c_get_type(), self->cptr);
+ return ret_boxed;
+}
+
+static void
+regress_test_boxed_c_wrapper_free (RegressTestBoxedCWrapper *boxed)
+{
+ g_boxed_free (regress_test_boxed_c_get_type(), boxed->cptr);
+ g_slice_free (RegressTestBoxedCWrapper, boxed);
+}
+
+G_DEFINE_BOXED_TYPE(RegressTestBoxedCWrapper,
+ regress_test_boxed_c_wrapper,
+ regress_test_boxed_c_wrapper_copy,
+ regress_test_boxed_c_wrapper_free);
+
+/**
+ * regress_test_boxed_c_wrapper_get
+ * @self: a #RegressTestBoxedCWrapper objects
+ *
+ * Returns: (transfer none): associated #RegressTestBoxedC
+**/
+RegressTestBoxedC *
+regress_test_boxed_c_wrapper_get (RegressTestBoxedCWrapper *self)
+{
+ return self->cptr;
+}
--- /dev/null
+#ifndef REGRESS_EXTRA_H
+#define REGRESS_EXTRA_H
+
+typedef struct _RegressTestBoxedC RegressTestBoxedC;
+typedef struct _RegressTestBoxedCWrapper RegressTestBoxedCWrapper;
+
+_GI_TEST_EXTERN
+GType regress_test_boxed_c_wrapper_get_type (void);
+
+_GI_TEST_EXTERN
+RegressTestBoxedCWrapper *regress_test_boxed_c_wrapper_new (void);
+_GI_TEST_EXTERN
+RegressTestBoxedCWrapper * regress_test_boxed_c_wrapper_copy (RegressTestBoxedCWrapper *self);
+_GI_TEST_EXTERN
+RegressTestBoxedC *regress_test_boxed_c_wrapper_get (RegressTestBoxedCWrapper *self);
+
+#endif /* REGRESS_EXTRA_H */
import os
import glob
import sys
-
+import signal
import unittest
+import subprocess
+import atexit
+
+import pytest
+
# this was renamed in Python 3, provide backwards compatible name
if sys.version_info[:2] == (2, 7):
unittest.TestCase.assertRegexpMatches = unittest.TestCase.assertRegex
unittest.TestCase.assertRaisesRegexp = unittest.TestCase.assertRaisesRegex
-
if '--help' in sys.argv:
print("Usage: ./runtests.py <testfiles>")
sys.exit(0)
+
+def dbus_launch_session():
+ if os.name == "nt" or sys.platform == "darwin":
+ return (-1, "")
+
+ try:
+ out = subprocess.check_output([
+ "dbus-daemon", "--session", "--fork", "--print-address=1",
+ "--print-pid=1"])
+ except (subprocess.CalledProcessError, OSError):
+ return (-1, "")
+ else:
+ if sys.version_info[0] == 3:
+ out = out.decode("utf-8")
+ addr, pid = out.splitlines()
+ return int(pid), addr
+
+
+pid, addr = dbus_launch_session()
+if pid >= 0:
+ os.environ["DBUS_SESSION_BUS_ADDRESS"] = addr
+ atexit.register(os.kill, pid, signal.SIGKILL)
+else:
+ os.environ["DBUS_SESSION_BUS_ADDRESS"] = "."
+
mydir = os.path.dirname(os.path.abspath(__file__))
tests_builddir = os.path.abspath(os.environ.get('TESTS_BUILDDIR', os.path.dirname(__file__)))
builddir = os.path.dirname(tests_builddir)
for filename in glob.iglob(os.path.join(mydir, 'test_*.py')):
names.append(os.path.basename(filename)[:-3])
-loader = unittest.TestLoader()
-suite = loader.loadTestsFromNames(names)
+
+def unittest_to_pytest_name(name):
+ parts = name.split(".")
+ parts[0] = os.path.join(mydir, parts[0] + ".py")
+ return "::".join(parts)
-# Run tests.
-runner = unittest.TextTestRunner(verbosity=2)
-result = runner.run(suite)
-if not result.wasSuccessful():
- sys.exit(1) # exit code so "make check" reports error
+sys.exit(pytest.main([unittest_to_pytest_name(n) for n in names]))
+++ /dev/null
-LC_IDENTIFICATION
-title "pygobject test locale"
-END LC_IDENTIFICATION
-
-LC_COLLATE
-copy "POSIX"
-END LC_COLLATE
-
-LC_CTYPE
-# a → a, other characters normally
-toupper (<U0061>,<U0061>); (<U0062>,<U0042>); (<U0063>,<U0043>); \
- (<U0076>,<U0056>); (<U006C>,<U004C>); (<U0075>,<U0055>); \
- (<U0065>,<U0045>);
-END LC_CTYPE
-
-LC_MESSAGES
-copy "en_US"
-END LC_MESSAGES
-
-LC_MONETARY
-copy "en_US"
-END LC_MONETARY
-
-LC_NUMERIC
-copy "POSIX"
-END LC_NUMERIC
-
-LC_TIME
-copy "POSIX"
-END LC_TIME
-
-LC_PAPER
-copy "en_US"
-END LC_PAPER
-
-LC_TELEPHONE
-copy "en_US"
-END LC_TELEPHONE
-
-LC_MEASUREMENT
-copy "en_US"
-END LC_MEASUREMENT
-
-LC_NAME
-copy "en_US"
-END LC_NAME
-
-LC_ADDRESS
-copy "en_US"
-END LC_ADDRESS
self.assertEqual(boxed, copy)
self.assertNotEqual(id(boxed), id(copy))
+ def test_boxed_c_wrapper(self):
+ wrapper = Everything.TestBoxedCWrapper()
+ obj = wrapper.get()
+
+ # TestBoxedC uses refcounting, so we know that
+ # it should be 2 at this point:
+ # - one owned by @wrapper
+ # - another owned by @obj
+ self.assertEqual(obj.refcount, 2)
+ del wrapper
+ self.assertEqual(obj.refcount, 1)
+
+ def test_boxed_c_wrapper_copy(self):
+ wrapper = Everything.TestBoxedCWrapper()
+ wrapper_copy = wrapper.copy()
+ obj = wrapper.get()
+
+ # TestBoxedC uses refcounting, so we know that
+ # it should be 3 at this point:
+ # - one owned by @wrapper
+ # - one owned by @wrapper_copy
+ # - another owned by @obj
+ self.assertEqual(obj.refcount, 3)
+ del wrapper
+ self.assertEqual(obj.refcount, 2)
+ del wrapper_copy
+ self.assertEqual(obj.refcount, 1)
+ del obj
+
class TestTortureProfile(unittest.TestCase):
def test_torture_profile(self):
return 'Node("%s", %s)' % (self.name, self.value)
-class TesterModel(GenericTreeModel):
+class ATesterModel(GenericTreeModel):
def __init__(self):
- super(TesterModel, self).__init__()
+ super(ATesterModel, self).__init__()
self.root = Node('root', 0,
Node('spam', 1,
Node('sushi', 2),
self.assertEqual(sys.getrefcount(obj), ref_count + 1)
def test_leak_references_on(self):
- model = TesterModel()
+ model = ATesterModel()
obj_ref = weakref.ref(model.root)
# Initial refcount is 1 for model.root + the temporary
self.assertEqual(sys.getrefcount(model.root), 2)
self.assertEqual(obj_ref(), None)
def test_row_deleted_frees_refs(self):
- model = TesterModel()
+ model = ATesterModel()
obj_ref = weakref.ref(model.root)
# Initial refcount is 1 for model.root + the temporary
self.assertEqual(sys.getrefcount(model.root), 2)
self.assertEqual(obj_ref(), None)
def test_leak_references_off(self):
- model = TesterModel()
+ model = ATesterModel()
model.leak_references = False
obj_ref = weakref.ref(model.root)
def test_iteration_refs(self):
# Pull iterators off the model using the wrapped C API which will
# then call back into the python overrides.
- model = TesterModel()
+ model = ATesterModel()
nodes = [node for node in model.iter_depth_first()]
values = [node.value for node in nodes]
@unittest.skipUnless(has_gtk, 'Gtk not available')
class TestIteration(unittest.TestCase):
def test_iter_next_root(self):
- model = TesterModel()
+ model = ATesterModel()
it = model.get_iter([0])
self.assertEqual(it.user_data, id(model.root))
self.assertEqual(model.root.next, None)
self.assertEqual(it, None)
def test_iter_next_multiple(self):
- model = TesterModel()
+ model = ATesterModel()
it = model.get_iter([0, 0])
self.assertEqual(it.user_data, id(model.root.children[0]))
import tempfile
import shutil
import os
-import locale
-import subprocess
import gc
import weakref
import warnings
class TestEnum(unittest.TestCase):
- @classmethod
- def setUpClass(cls):
- '''Run tests under a test locale.
-
- Upper case conversion of member names should not be locale specific
- e. g. in Turkish, "i".upper() == "i", which gives results like "iNVALiD"
-
- Run test under a locale which defines toupper('a') == 'a'
- '''
- if sys.platform == "darwin" or os.name == "nt":
- return
- cls.locale_dir = tempfile.mkdtemp()
- src = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'te_ST@nouppera')
- dest = os.path.join(cls.locale_dir, 'te_ST.UTF-8@nouppera')
- subprocess.check_call(['localedef', '-i', src, '-c', '-f', 'UTF-8', dest])
- os.environ['LOCPATH'] = cls.locale_dir
- locale.setlocale(locale.LC_ALL, 'te_ST.UTF-8@nouppera')
-
- @classmethod
- def tearDownClass(cls):
- if sys.platform == "darwin" or os.name == "nt":
- return
- locale.setlocale(locale.LC_ALL, 'C')
- shutil.rmtree(cls.locale_dir)
- try:
- del os.environ['LOCPATH']
- except KeyError:
- pass
-
def test_enum(self):
self.assertTrue(issubclass(GIMarshallingTests.Enum, int))
self.assertTrue(isinstance(GIMarshallingTests.Enum.VALUE1, GIMarshallingTests.Enum))
import threading
from contextlib import contextmanager
-from gi.repository import Gtk, Gio, GLib
+try:
+ from gi.repository import Gtk
+except ImportError:
+ Gtk = None
+from gi.repository import Gio, GLib
from gi._ossighelper import wakeup_on_signal, register_sigint_fallback
app.connect("activate", lambda *args: None)
app.run()
- @unittest.skipIf(os.name == "nt", "not on Windows")
+ @unittest.skipIf(Gtk is None or os.name == "nt", "not on Windows")
def test_gtk_main(self):
signal.signal(signal.SIGALRM, lambda *args: Gtk.main_quit())
GLib.idle_add(signal.setitimer, signal.ITIMER_REAL, 0.001)
with self._run_with_timeout(2000, Gtk.main_quit):
Gtk.main()
- @unittest.skipIf(os.name == "nt", "not on Windows")
+ @unittest.skipIf(Gtk is None or os.name == "nt", "not on Windows")
def test_gtk_dialog_run(self):
w = Gtk.Window()
d = Gtk.Dialog(transient_for=w)
try:
from gi.repository import Gdk, GdkPixbuf, Gtk
- Gdk # pyflakes
+ Gdk_version = Gdk._version
except ImportError:
Gdk = None
+ Gdk_version = None
from helper import capture_glib_deprecation_warnings
class TestGdk(unittest.TestCase):
@unittest.skipIf(sys.platform == "darwin" or os.name == "nt", "crashes")
- @unittest.skipIf(Gdk._version == "4.0", "not in gdk4")
+ @unittest.skipIf(Gdk_version == "4.0", "not in gdk4")
def test_constructor(self):
attribute = Gdk.WindowAttr()
attribute.window_type = Gdk.WindowType.CHILD
window = Gdk.Window(None, attribute, attributes_mask)
self.assertEqual(window.get_window_type(), Gdk.WindowType.CHILD)
- @unittest.skipIf(Gdk._version == "4.0", "not in gdk4")
+ @unittest.skipIf(Gdk_version == "4.0", "not in gdk4")
def test_color(self):
color = Gdk.Color(100, 200, 300)
self.assertEqual(color.red, 100)
self.assertEqual(color, Gdk.Color(100, 200, 300))
self.assertNotEqual(color, Gdk.Color(1, 2, 3))
- @unittest.skipIf(Gdk._version == "4.0", "not in gdk4")
+ @unittest.skipIf(Gdk_version == "4.0", "not in gdk4")
def test_color_floats(self):
self.assertEqual(Gdk.Color(13107, 21845, 65535),
Gdk.Color.from_floats(0.2, 1.0 / 3.0, 1.0))
event = Gdk.Event.new(Gdk.EventType.CONFIGURE)
self.assertTrue("CONFIGURE" in repr(event))
- @unittest.skipIf(Gdk._version == "4.0", "not in gdk4")
+ @unittest.skipIf(Gdk_version == "4.0", "not in gdk4")
def test_event_structures(self):
def button_press_cb(button, event):
self.assertTrue(isinstance(event, Gdk.EventButton))
Gdk.ModifierType.CONTROL_MASK,
Gdk.EventType.BUTTON_PRESS)
- @unittest.skipIf(Gdk._version == "4.0", "not in gdk4")
+ @unittest.skipIf(Gdk_version == "4.0", "not in gdk4")
def test_cursor(self):
self.assertEqual(Gdk.Cursor, gi.overrides.Gdk.Cursor)
with capture_glib_deprecation_warnings():
self.assertEqual(str(Gdk.ModifierType.RELEASE_MASK | Gdk.ModifierType.META_MASK),
'<flags GDK_META_MASK | GDK_RELEASE_MASK of type Gdk.ModifierType>')
- @unittest.skipIf(Gdk._version == "4.0", "not in gdk4")
+ @unittest.skipIf(Gdk_version == "4.0", "not in gdk4")
def test_color_parse(self):
with capture_glib_deprecation_warnings():
c = Gdk.color_parse('#00FF80')
self.assertEqual(c.blue, 32896)
self.assertEqual(Gdk.color_parse('bogus'), None)
- @unittest.skipIf(Gdk._version == "4.0", "not in gdk4")
+ @unittest.skipIf(Gdk_version == "4.0", "not in gdk4")
def test_color_representations(self):
# __repr__ should generate a string which is parsable when possible
# http://docs.python.org/2/reference/datamodel.html#object.__repr__
try:
from gi.repository import Gtk, GdkPixbuf, Gdk
PyGTKDeprecationWarning = Gtk.PyGTKDeprecationWarning
+ Gtk_version = Gtk._version
except ImportError:
Gtk = None
+ Gtk_version = None
PyGTKDeprecationWarning = None
GdkPixbuf = None
Gdk = None
labels = [x for x in box]
self.assertEqual(labels, [label, label2])
- @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_actions(self):
self.assertEqual(Gtk.Action, gi.overrides.Gtk.Action)
action = Gtk.Action(name="test", label="Test", tooltip="Test Action", stock_id=Gtk.STOCK_COPY)
self.assertEqual(action.get_stock_id(), Gtk.STOCK_COPY)
self.assertEqual(action.get_current_value(), 1)
- @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_actiongroup(self):
self.assertEqual(Gtk.ActionGroup, gi.overrides.Gtk.ActionGroup)
expected_results.remove(a)
action.activate()
- @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_uimanager(self):
self.assertEqual(Gtk.UIManager, gi.overrides.Gtk.UIManager)
ui = Gtk.UIManager()
self.assertEqual(ag, groups[-2])
self.assertEqual(ag2, groups[-1])
- @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_uimanager_nonascii(self):
ui = Gtk.UIManager()
ui.add_ui_from_string(b'<ui><menubar name="menub\xc3\xa6r1" /></ui>'.decode('UTF-8'))
self.assertEqual(Gtk.Dialog, gi.overrides.Gtk.Dialog)
self.assertEqual(Gtk.FileChooserDialog, gi.overrides.Gtk.FileChooserDialog)
self.assertEqual(Gtk.RecentChooserDialog, gi.overrides.Gtk.RecentChooserDialog)
- if Gtk._version != "4.0":
+ if Gtk_version != "4.0":
self.assertEqual(Gtk.ColorSelectionDialog, gi.overrides.Gtk.ColorSelectionDialog)
self.assertEqual(Gtk.FontSelectionDialog, gi.overrides.Gtk.FontSelectionDialog)
self.assertEqual(dialog.get_property('secondary-text'), '2nd markup')
self.assertTrue(dialog.get_property('secondary-use-markup'))
- @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_color_selection_dialog(self):
dialog = Gtk.ColorSelectionDialog(title="color selection dialog test")
self.assertTrue(isinstance(dialog, Gtk.Dialog))
action = dialog.get_property('action')
self.assertEqual(Gtk.FileChooserAction.OPEN, action)
- @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_font_selection_dialog(self):
dialog = Gtk.FontSelectionDialog(title="font selection dialog test")
self.assertTrue(isinstance(dialog, Gtk.Dialog))
self.assertTrue(isinstance(button, Gtk.Container))
self.assertTrue(isinstance(button, Gtk.Widget))
- if Gtk._version != "4.0":
+ if Gtk_version != "4.0":
# Using stock items causes hard warning in devel versions of GTK+.
with capture_glib_warnings(allow_warnings=True):
button = Gtk.Button.new_from_stock(Gtk.STOCK_CLOSE)
adjustment = Gtk.Adjustment(1, -1, 3, 0, 0, 0, value=2)
self.adjustment_check(adjustment, value=2, lower=-1, upper=3)
- @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_table(self):
table = Gtk.Table()
self.assertTrue(isinstance(table, Gtk.Table))
widget.drag_source_add_uri_targets()
widget.drag_source_set_icon_name("_About")
widget.drag_source_set_icon_pixbuf(GdkPixbuf.Pixbuf())
- if Gtk._version != "4.0":
+ if Gtk_version != "4.0":
widget.drag_source_set_icon_stock(Gtk.STOCK_ABOUT)
widget.drag_source_get_target_list()
widget.drag_source_set_target_list(None)
# these methods cannot be called because they require a valid drag on
# a real GdkWindow. So we only check that they exist and are callable.
- if Gtk._version != "4.0":
+ if Gtk_version != "4.0":
self.assertTrue(hasattr(widget, 'drag_dest_set_proxy'))
self.assertTrue(hasattr(widget, 'drag_get_data'))
treeview.enable_model_drag_dest(mixed_target_list,
Gdk.DragAction.DEFAULT | Gdk.DragAction.MOVE)
- @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_scrollbar(self):
adjustment = Gtk.Adjustment()
iconview = Gtk.IconView(model=model)
self.assertEqual(iconview.props.model, model)
- @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_toolbutton(self):
# PyGTK compat
self.assertEqual(button.props.label, 'mylabel')
self.assertEqual(button.props.icon_widget, icon)
- @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_iconset(self):
Gtk.IconSet()
pixbuf = GdkPixbuf.Pixbuf()
self.assertEqual(viewport.props.vadjustment, vadjustment)
self.assertEqual(viewport.props.hadjustment, hadjustment)
- @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_stock_lookup(self):
stock_item = Gtk.stock_lookup('gtk-ok')
self.assertEqual(type(stock_item), Gtk.StockItem)
GLib.idle_add(Gtk.main_quit, 'hello')
Gtk.main()
- @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_widget_render_icon(self):
button = Gtk.Button(label='OK')
pixbuf = button.render_icon(Gtk.STOCK_OK, Gtk.IconSize.BUTTON)
@unittest.skipUnless(Gtk, 'Gtk not available')
-@unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+@unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
class TestWidget(unittest.TestCase):
def test_style_get_property_gvalue(self):
button = Gtk.Button()
@unittest.skipUnless(Gtk, 'Gtk not available')
class TestContainer(unittest.TestCase):
- @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_child_set_property(self):
box = Gtk.Box()
child = Gtk.Button()
box.child_get_property(child, 'padding', value)
self.assertEqual(value.get_int(), 42)
- @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_child_get_property_gvalue(self):
box = Gtk.Box()
child = Gtk.Button()
box.child_get_property(child, 'padding', value)
self.assertEqual(value.get_int(), 42)
- @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_child_get_property_return_with_explicit_gvalue(self):
box = Gtk.Box()
child = Gtk.Button()
result = box.child_get_property(child, 'padding', value)
self.assertEqual(result, 42)
- @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_child_get_property_return_with_implicit_gvalue(self):
box = Gtk.Box()
child = Gtk.Button()
def test_child_get_property_error(self):
box = Gtk.Box()
child = Gtk.Button()
- if Gtk._version == "4.0":
+ if Gtk_version == "4.0":
box.pack_start(child, expand=False, fill=True)
else:
box.pack_start(child, expand=False, fill=True, padding=42)
with self.assertRaises(ValueError):
box.child_get_property(child, 'not-a-valid-child-property')
- @unittest.skipIf(Gtk._version == "4.0", "not in gtk4")
+ @unittest.skipIf(Gtk_version == "4.0", "not in gtk4")
def test_child_get_and_set(self):
box = Gtk.Box()
child = Gtk.Button()
self.assertEqual(fill, False)
self.assertEqual(padding, 21)
- @unittest.skipIf(Gtk._version != "4.0", "only in gtk4")
+ @unittest.skipIf(Gtk_version != "4.0", "only in gtk4")
def test_child_get_and_set_gtk4(self):
# padding got removed in gtk4
box = Gtk.Box()