summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitlab-ci.yml12
-rw-r--r--.gitlab-ci/Dockerfile4
-rwxr-xr-x.gitlab-ci/run-docker.sh4
-rw-r--r--gi/_gtktemplate.py2
-rw-r--r--tests/test_gtk_template.py37
5 files changed, 46 insertions, 13 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index f53bddf1..5e899b5d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,4 @@
-image: registry.gitlab.gnome.org/gnome/pygobject/main:v6
+image: registry.gitlab.gnome.org/gnome/pygobject/main:v7
stages:
- build_and_test
@@ -34,7 +34,7 @@ coverage:
paths:
- coverage/
variables:
- PYENV_VERSION: "3.6.5"
+ PYENV_VERSION: "3.6.6"
script:
- bash -x ./.gitlab-ci/coverage-docker.sh
@@ -59,7 +59,6 @@ python2-mingw32:
<<: *mingw-defaults
python2-mingw64:
- when: manual
variables:
PYTHON: "python2"
MSYSTEM: "MINGW64"
@@ -67,7 +66,6 @@ python2-mingw64:
<<: *mingw-defaults
python3-mingw32:
- when: manual
variables:
PYTHON: "python3"
MSYSTEM: "MINGW32"
@@ -87,19 +85,18 @@ python2.7:
<<: *defaults
python3.5:
- when: manual
variables:
PYENV_VERSION: "3.5.5"
<<: *defaults
python3.6:
variables:
- PYENV_VERSION: "3.6.5"
+ PYENV_VERSION: "3.6.6"
<<: *defaults
python3.7:
variables:
- PYENV_VERSION: "3.7.0b3"
+ PYENV_VERSION: "3.7.0"
<<: *defaults
pypy2:
@@ -109,7 +106,6 @@ pypy2:
<<: *defaults
pypy3:
- when: manual
allow_failure: true
variables:
PYENV_VERSION: "pypy3.5-6.0.0"
diff --git a/.gitlab-ci/Dockerfile b/.gitlab-ci/Dockerfile
index cd1aa1bb..cc9cff48 100644
--- a/.gitlab-ci/Dockerfile
+++ b/.gitlab-ci/Dockerfile
@@ -41,8 +41,8 @@ RUN curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/p
RUN pyenv install 2.7.15
RUN pyenv install 3.5.5
-RUN pyenv install 3.6.5
-RUN pyenv install 3.7.0b3
+RUN pyenv install 3.6.6
+RUN pyenv install 3.7.0
RUN pyenv install pypy2.7-6.0.0
RUN pyenv install pypy3.5-6.0.0
diff --git a/.gitlab-ci/run-docker.sh b/.gitlab-ci/run-docker.sh
index aed88316..f80312da 100755
--- a/.gitlab-ci/run-docker.sh
+++ b/.gitlab-ci/run-docker.sh
@@ -2,10 +2,10 @@
set -e
-TAG="registry.gitlab.gnome.org/gnome/pygobject/main:v6"
+TAG="registry.gitlab.gnome.org/gnome/pygobject/main:v7"
sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
--file "Dockerfile" .
-sudo docker run -e PYENV_VERSION='3.6.5' --rm --security-opt label=disable \
+sudo docker run -e PYENV_VERSION='3.6.6' --rm --security-opt label=disable \
--volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \
--tty --interactive "${TAG}" bash
diff --git a/gi/_gtktemplate.py b/gi/_gtktemplate.py
index df9afdbd..a345f5d2 100644
--- a/gi/_gtktemplate.py
+++ b/gi/_gtktemplate.py
@@ -99,7 +99,7 @@ def register_template(cls):
def init_template(self, cls, base_init_template):
- cls.init_template = lambda s: None
+ self.init_template = lambda s: None
if self.__class__ is not cls:
raise TypeError(
diff --git a/tests/test_gtk_template.py b/tests/test_gtk_template.py
index 6f112dde..f0cc963d 100644
--- a/tests/test_gtk_template.py
+++ b/tests/test_gtk_template.py
@@ -79,9 +79,46 @@ def test_allow_init_template_call():
super(Foo, self).__init__()
self.init_template()
+ # Stop current pygobject from handling the initialisation
+ del Foo.__dontuse_ginstance_init__
+
Foo()
+def test_init_template_second_instance():
+ type_name = new_gtype_name()
+
+ xml = """\
+<interface>
+ <template class="{0}" parent="GtkBox">
+ <child>
+ <object class="GtkLabel" id="label">
+ </object>
+ </child>
+ </template>
+</interface>
+""".format(type_name)
+
+ @Gtk.Template.from_string(xml)
+ class Foo(Gtk.Box):
+ __gtype_name__ = type_name
+
+ label = Gtk.Template.Child("label")
+
+ def __init__(self):
+ super(Foo, self).__init__()
+ self.init_template()
+
+ # Stop current pygobject from handling the initialisation
+ del Foo.__dontuse_ginstance_init__
+
+ foo = Foo()
+ assert isinstance(foo.label, Gtk.Label)
+
+ foo2 = Foo()
+ assert isinstance(foo2.label, Gtk.Label)
+
+
def test_main_example():
type_name = new_gtype_name()