pidgin/tests/test-wrapper.py

Sun, 03 Nov 2024 00:05:44 -0500

author
Gary Kramlich <grim@reaperworld.com>
date
Sun, 03 Nov 2024 00:05:44 -0500
changeset 43045
308e8d0ce68c
parent 42479
d0faa9b1ac85
permissions
-rwxr-xr-x

remove purple3-url-handler.desktop.in.in

The application that did the launching was removed long ago. Also this should
be implemented by the user interfaces and they might provide separate files to
groups schemas as well.

Testing Done:
Called in the turtles.

Reviewed at https://reviews.imfreedom.org/r/3640/

42456
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 #!/usr/bin/env python3
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 #
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 # Pidgin - Internet Messenger
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 # Copyright (C) Pidgin Developers <devel@pidgin.im>
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 #
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 # Pidgin is the legal property of its developers, whose names are too numerous
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 # to list here. Please refer to the COPYRIGHT file distributed with this
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 # source distribution.
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 #
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 # This program is free software; you can redistribute it and/or modify
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 # it under the terms of the GNU General Public License as published by
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 # the Free Software Foundation; either version 2 of the License, or
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 # (at your option) any later version.
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 #
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 # This program is distributed in the hope that it will be useful,
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 # GNU General Public License for more details.
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 #
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 # You should have received a copy of the GNU General Public License
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 # along with this library; if not, see <https://www.gnu.org/licenses/>.
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 """
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 This script will run the command specified via command line arguments,
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 making sure broadwayd is running and will be used.
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 """
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 import os
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29 import subprocess
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 import sys
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
33 def main():
42479
d0faa9b1ac85 Make broadwayd optional for unit testing
Gary Kramlich <grim@reaperworld.com>
parents: 42456
diff changeset
34 if len(sys.argv) < 2:
d0faa9b1ac85 Make broadwayd optional for unit testing
Gary Kramlich <grim@reaperworld.com>
parents: 42456
diff changeset
35 print('invalid arguments:')
d0faa9b1ac85 Make broadwayd optional for unit testing
Gary Kramlich <grim@reaperworld.com>
parents: 42456
diff changeset
36 print(f'usage: {sys.argv[0]} [path to gtk4-broadwayd] [tests]...')
d0faa9b1ac85 Make broadwayd optional for unit testing
Gary Kramlich <grim@reaperworld.com>
parents: 42456
diff changeset
37 sys.exit(1)
d0faa9b1ac85 Make broadwayd optional for unit testing
Gary Kramlich <grim@reaperworld.com>
parents: 42456
diff changeset
38
42456
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 # start broadway
42479
d0faa9b1ac85 Make broadwayd optional for unit testing
Gary Kramlich <grim@reaperworld.com>
parents: 42456
diff changeset
40 broadwayd = subprocess.Popen(sys.argv[1])
42456
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 # run the unit test but set the GDK_BACKEND envvar to broadway
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 env = {**os.environ, 'GDK_BACKEND': 'broadway'}
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 try:
42479
d0faa9b1ac85 Make broadwayd optional for unit testing
Gary Kramlich <grim@reaperworld.com>
parents: 42456
diff changeset
46 proc = subprocess.run(args=sys.argv[2:], env=env)
42456
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 finally:
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 # kill broadway
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 broadwayd.kill()
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 # return the exit code of the unit test
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 sys.exit(proc.returncode)
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 if __name__ == '__main__':
73bb1fae628c Create pidgin_text_buffer API for working with GtkTextBuffers
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 main()

mercurial