File: import-repeatedly.c

package info (click to toggle)
dbus-python 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,708 kB
  • sloc: ansic: 9,653; python: 4,664; makefile: 597; sh: 428
file content (36 lines) | stat: -rw-r--r-- 741 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* Regression test for https://bugs.freedesktop.org/show_bug.cgi?id=23831 */
/*
 * Copyright 2010-2016 Collabora Ltd.
 * SPDX-License-Identifier: MIT
 */

#include <stdio.h>

#include <Python.h>

#include "dbus_bindings-internal.h"

int main(void)
{
    int i;

    puts("1..1");

    for (i = 0; i < 100; ++i) {
        Py_Initialize();
        if (PyRun_SimpleString("import dbus\n") != 0) {
            puts("not ok 1 - there was an exception");
            return 1;
        }
        Py_Finalize();

#if DBUSPY_PY_VERSION_AT_LEAST(3, 12, 0, 0)
        puts("ok 1 # SKIP https://gitlab.freedesktop.org/dbus/dbus-python/-/issues/55");
        return 0;
#endif
    }

    puts("ok 1 - was able to import dbus 100 times");

    return 0;
}