Rage-cleanup.

While trying to get the unit tests working again I stumbled over all those
things that I thought could be better^TM.

Now we also know "TODO: why does this make the test fail?" - because
the unit tests are brittle AF ... and we have to init the subsystems
we use in the test, otherwise the cleanup will fail...

BTW. you can now also only run a single test ... or a pattern or so ...
you'd have to read how `cmocka_set_test_filter()` works exactly.

Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
This commit is contained in:
Steffen Jaeckel
2025-03-07 19:03:10 +01:00
parent 72b99ceb6d
commit c0da36c48d
26 changed files with 139 additions and 110 deletions

View File

@@ -69,12 +69,6 @@ disable_python_threads()
PyEval_RestoreThread(thread_state);
}
static void
_unref_module(PyObject* module)
{
Py_XDECREF(module);
}
const char*
python_get_version_string(void)
{
@@ -95,14 +89,15 @@ python_get_version_number(void)
void
python_env_init(void)
{
loaded_modules = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)_unref_module);
loaded_modules = g_hash_table_new_full(g_str_hash, g_str_equal, free, (GDestroyNotify)Py_XDECREF);
python_init_prof();
auto_gchar gchar* plugins_dir = files_get_data_path(DIR_PLUGINS);
auto_gchar gchar* path = g_strdup_printf(
"import sys\n"
"sys.path.append(\"%s/\")\n", plugins_dir);
"import sys\n"
"sys.path.append(\"%s/\")\n",
plugins_dir);
PyRun_SimpleString(path);
python_check_error();