gplugin/gplugin

Update the python tests to explicitly name python3
feature/python3-naming
2020-02-22, Gary Kramlich
0ccb96436622
Parents 70cb1c992a08
Children ce494367e404
Update the python tests to explicitly name python3
--- a/python/tests/meson.build Sat Feb 22 03:29:51 2020 -0600
+++ b/python/tests/meson.build Sat Feb 22 03:33:17 2020 -0600
@@ -1,26 +1,22 @@
if get_option('python')
-e = executable('test-python-loader', 'test-python-loader.c',
+e = executable('test-python3-loader', 'test-python3-loader.c',
include_directories : include_directories('.'),
c_args : [
- '-DPYTHON_LOADER_DIR="@0@"'.format(join_paths(meson.current_build_dir(), '..')),
- '-DPYTHON_PLUGIN_DIR="@0@/plugins"'.format(meson.current_source_dir()),
+ '-DPYTHON3_LOADER_DIR="@0@"'.format(join_paths(meson.current_build_dir(), '..')),
+ '-DPYTHON3_PLUGIN_DIR="@0@/plugins"'.format(meson.current_source_dir()),
],
link_with : gplugin_loader_tests,
dependencies : [GLIB, GOBJECT, PYTHON3, PYGOBJECT, gplugin_dep])
-test('Python loader', e)
+test('Python3 loader', e)
# we can't see the symbols in gplugin-python externally, so use the static
# version for testing
-e = executable('test-python-utils', 'test-python-utils.c',
+e = executable('test-python3-utils', 'test-python3-utils.c',
include_directories : include_directories('.'),
- c_args : [
- '-DPYTHON_LOADER_DIR="@0@"'.format(join_paths(meson.current_build_dir(), '..')),
- '-DPYTHON_PLUGIN_DIR="@0@/plugins"'.format(meson.current_source_dir()),
- ],
link_with : [gplugin_loader_tests],
dependencies : [GLIB, GOBJECT, PYTHON3, PYGOBJECT,
gplugin_python_static_dep])
-test('Python utils', e)
+test('Python3 utils', e)
endif # python
--- a/python/tests/test-python-loader.c Sat Feb 22 03:29:51 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <glib.h>
-#include <gplugin.h>
-
-#include <gplugin/gplugin-loader-tests.h>
-
-/******************************************************************************
- * Main
- *****************************************************************************/
-gint
-main(gint argc, gchar **argv) {
- g_test_init(&argc, &argv, NULL);
-
- gplugin_loader_tests_main(PYTHON_LOADER_DIR, PYTHON_PLUGIN_DIR, "python3");
-
- return g_test_run();
-}
--- a/python/tests/test-python-utils.c Sat Feb 22 03:29:51 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include <Python.h>
-
-#include "gplugin-python-utils.h"
-
-#include <glib.h>
-
-/******************************************************************************
- * filename to module tests
- *****************************************************************************/
-static void
-test_filename_to_module_NULL_subprocess(void) {
- gplugin_python_filename_to_module(NULL);
-}
-
-static void
-test_filename_to_module_NULL(void) {
- g_test_trap_subprocess("/loaders/python/utils/filename_to_module/NULL/subprocess", 0, 0);
-
- g_test_trap_assert_failed();
-}
-
-static void
-test_filename_to_module_empty(void) {
- gchar *module = gplugin_python_filename_to_module("");
-
- g_assert_cmpstr(module, ==, "");
-
- g_free(module);
-}
-
-static void
-test_filename_to_module_no_extension(void) {
- gchar *module = gplugin_python_filename_to_module("foo");
-
- g_assert_cmpstr(module, ==, "foo");
-
- g_free(module);
-}
-
-/******************************************************************************
- * Main
- *****************************************************************************/
-gint
-main(gint argc, gchar **argv) {
- g_test_init(&argc, &argv, NULL);
-
- /* tests */
- g_test_add_func("/loaders/python/utils/filename_to_module/NULL",
- test_filename_to_module_NULL);
- g_test_add_func("/loaders/python/utils/filename_to_module/NULL/subprocess",
- test_filename_to_module_NULL_subprocess);
- g_test_add_func("/loaders/python/utils/filename_to_module/empty",
- test_filename_to_module_empty);
- g_test_add_func("/loaders/python/utils/filename_to_module/no-extension",
- test_filename_to_module_no_extension);
-
- return g_test_run();
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/python/tests/test-python3-loader.c Sat Feb 22 03:33:17 2020 -0600
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <glib.h>
+#include <gplugin.h>
+
+#include <gplugin/gplugin-loader-tests.h>
+
+/******************************************************************************
+ * Main
+ *****************************************************************************/
+gint
+main(gint argc, gchar **argv) {
+ g_test_init(&argc, &argv, NULL);
+
+ gplugin_loader_tests_main(PYTHON3_LOADER_DIR, PYTHON3_PLUGIN_DIR, "python3");
+
+ return g_test_run();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/python/tests/test-python3-utils.c Sat Feb 22 03:33:17 2020 -0600
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2011-2020 Gary Kramlich <grim@reaperworld.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <Python.h>
+
+#include "gplugin-python-utils.h"
+
+#include <glib.h>
+
+/******************************************************************************
+ * filename to module tests
+ *****************************************************************************/
+static void
+test_filename_to_module_NULL_subprocess(void) {
+ gplugin_python_filename_to_module(NULL);
+}
+
+static void
+test_filename_to_module_NULL(void) {
+ g_test_trap_subprocess("/loaders/python/utils/filename_to_module/NULL/subprocess", 0, 0);
+
+ g_test_trap_assert_failed();
+}
+
+static void
+test_filename_to_module_empty(void) {
+ gchar *module = gplugin_python_filename_to_module("");
+
+ g_assert_cmpstr(module, ==, "");
+
+ g_free(module);
+}
+
+static void
+test_filename_to_module_no_extension(void) {
+ gchar *module = gplugin_python_filename_to_module("foo");
+
+ g_assert_cmpstr(module, ==, "foo");
+
+ g_free(module);
+}
+
+/******************************************************************************
+ * Main
+ *****************************************************************************/
+gint
+main(gint argc, gchar **argv) {
+ g_test_init(&argc, &argv, NULL);
+
+ /* tests */
+ g_test_add_func("/loaders/python/utils/filename_to_module/NULL",
+ test_filename_to_module_NULL);
+ g_test_add_func("/loaders/python/utils/filename_to_module/NULL/subprocess",
+ test_filename_to_module_NULL_subprocess);
+ g_test_add_func("/loaders/python/utils/filename_to_module/empty",
+ test_filename_to_module_empty);
+ g_test_add_func("/loaders/python/utils/filename_to_module/no-extension",
+ test_filename_to_module_no_extension);
+
+ return g_test_run();
+}