151 lines
5.9 KiB
Diff
151 lines
5.9 KiB
Diff
From 340e316bd6384562086b4e381c8cd42b1ccd0781 Mon Sep 17 00:00:00 2001
|
|
From: Stephen Gallagher <sgallagh@redhat.com>
|
|
Date: Tue, 28 May 2019 14:28:30 -0400
|
|
Subject: [PATCH 3/3] Fix transfer type for Module.search_streams()
|
|
|
|
Technically this is an API-breaking change, but no one is using it
|
|
yet and it was always expected to be managed this way.
|
|
|
|
Fixes: https://github.com/fedora-modularity/libmodulemd/issues/308
|
|
|
|
Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
|
|
---
|
|
modulemd/meson.build | 1 +
|
|
.../v2/include/modulemd-2.0/modulemd-module.h | 4 +-
|
|
modulemd/v2/meson.build | 17 ++++++-
|
|
modulemd/v2/tests/ModulemdTests/module.py | 46 +++++++++++++++++++
|
|
4 files changed, 65 insertions(+), 3 deletions(-)
|
|
create mode 100644 modulemd/v2/tests/ModulemdTests/module.py
|
|
|
|
diff --git a/modulemd/meson.build b/modulemd/meson.build
|
|
index e49c7a9df76dcf37a18ddeba3150d6c914aa4e25..e5912d4041ba3e427d13b98c0eeca5217d48244b 100644
|
|
--- a/modulemd/meson.build
|
|
+++ b/modulemd/meson.build
|
|
@@ -229,10 +229,11 @@ test_v2_python_scripts = files(
|
|
'v2/tests/ModulemdTests/componentrpm.py',
|
|
'v2/tests/ModulemdTests/defaults.py',
|
|
'v2/tests/ModulemdTests/defaultsv1.py',
|
|
'v2/tests/ModulemdTests/dependencies.py',
|
|
'v2/tests/ModulemdTests/merger.py',
|
|
+ 'v2/tests/ModulemdTests/module.py',
|
|
'v2/tests/ModulemdTests/moduleindex.py',
|
|
'v2/tests/ModulemdTests/modulestream.py',
|
|
'v2/tests/ModulemdTests/profile.py',
|
|
'v2/tests/ModulemdTests/rpmmap.py',
|
|
'v2/tests/ModulemdTests/servicelevel.py',
|
|
diff --git a/modulemd/v2/include/modulemd-2.0/modulemd-module.h b/modulemd/v2/include/modulemd-2.0/modulemd-module.h
|
|
index 45be9c0ae96e203707da61d84f18c71c4a826035..0219cfe227652813d20bdf736f9033782084c5ad 100644
|
|
--- a/modulemd/v2/include/modulemd-2.0/modulemd-module.h
|
|
+++ b/modulemd/v2/include/modulemd-2.0/modulemd-module.h
|
|
@@ -129,12 +129,12 @@ modulemd_module_get_stream_by_NSVC (ModulemdModule *self,
|
|
* @context: (nullable): The context of the stream to retrieve. If NULL, the
|
|
* context is not included in the search.
|
|
* @arch: (nullable): The processor architecture of the stream to retrieve. If
|
|
* NULL, the architecture is not included in the search.
|
|
*
|
|
- * Returns: (transfer full) (element-type ModulemdModuleStream): The list of
|
|
- * stream objects matching the requested parameters. This function cannot
|
|
+ * Returns: (transfer container) (element-type ModulemdModuleStream): The list
|
|
+ * of stream objects matching the requested parameters. This function cannot
|
|
* fail, but it may return a zero-length list if no matches were found. The
|
|
* returned streams will be in a predictable order, sorted first by stream
|
|
* name, then by version (highest to lowest), then by context and finally by
|
|
* architecture.
|
|
*
|
|
diff --git a/modulemd/v2/meson.build b/modulemd/v2/meson.build
|
|
index 3f45db2c4e0e9a8996c74dffd949d5276082dc6f..e8a5a38f0528c4f860f0b84ef63609ff5fd89caa 100644
|
|
--- a/modulemd/v2/meson.build
|
|
+++ b/modulemd/v2/meson.build
|
|
@@ -390,20 +390,35 @@ test ('dependencies_python2_debug', python2,
|
|
args : dependencies_python_script)
|
|
test ('dependencies_python2_release', python2,
|
|
env : py_test_release_env,
|
|
args : dependencies_python_script)
|
|
|
|
+# -- Test Modulemd.Module (Python) -- #
|
|
+module_python_script = files('tests/ModulemdTests/module.py')
|
|
+test ('module_python3_debug', python3,
|
|
+ env : py_test_env,
|
|
+ args : module_python_script)
|
|
+test ('module_python3_release', python3,
|
|
+ env : py_test_release_env,
|
|
+ args : module_python_script)
|
|
+
|
|
+test ('module_python2_debug', python2,
|
|
+ env : py_test_env,
|
|
+ args : module_python_script)
|
|
+test ('module_python2_release', python2,
|
|
+ env : py_test_release_env,
|
|
+ args : module_python_script)
|
|
+
|
|
# -- Test Modulemd.ModuleIndex (Python) -- #
|
|
moduleindex_python_script = files('tests/ModulemdTests/moduleindex.py')
|
|
test ('moduleindex_python3_debug', python3,
|
|
env : py_test_env,
|
|
args : moduleindex_python_script)
|
|
test ('moduleindex_python3_release', python3,
|
|
env : py_test_release_env,
|
|
args : moduleindex_python_script)
|
|
|
|
-moduleindex_python_script = files('tests/ModulemdTests/moduleindex.py')
|
|
test ('moduleindex_python2_debug', python2,
|
|
env : py_test_env,
|
|
args : moduleindex_python_script)
|
|
test ('moduleindex_python2_release', python2,
|
|
env : py_test_release_env,
|
|
diff --git a/modulemd/v2/tests/ModulemdTests/module.py b/modulemd/v2/tests/ModulemdTests/module.py
|
|
new file mode 100644
|
|
index 0000000000000000000000000000000000000000..b604d9c9b357c4a5211d3ba5b4d0aba08c3a42bd
|
|
--- /dev/null
|
|
+++ b/modulemd/v2/tests/ModulemdTests/module.py
|
|
@@ -0,0 +1,46 @@
|
|
+#!/usr/bin/python3
|
|
+
|
|
+# This file is part of libmodulemd
|
|
+# Copyright (C) 2017-2018 Stephen Gallagher
|
|
+#
|
|
+# Fedora-License-Identifier: MIT
|
|
+# SPDX-2.0-License-Identifier: MIT
|
|
+# SPDX-3.0-License-Identifier: MIT
|
|
+#
|
|
+# This program is free software.
|
|
+# For more information on the license, see COPYING.
|
|
+# For more information on free software, see
|
|
+# <https://www.gnu.org/philosophy/free-sw.en.html>.
|
|
+
|
|
+from os import path
|
|
+import sys
|
|
+try:
|
|
+ import unittest
|
|
+ import gi
|
|
+ gi.require_version('Modulemd', '2.0')
|
|
+ from gi.repository import Modulemd
|
|
+ from gi.repository.Modulemd import ModuleIndex
|
|
+ from gi.repository import GLib
|
|
+except ImportError:
|
|
+ # Return error 77 to skip this test on platforms without the necessary
|
|
+ # python modules
|
|
+ sys.exit(77)
|
|
+
|
|
+from base import TestBase
|
|
+
|
|
+
|
|
+class TestModule(TestBase):
|
|
+
|
|
+ def test_search_streams(self):
|
|
+ idx = Modulemd.ModuleIndex.new()
|
|
+ idx.update_from_file(path.join(self.source_root,
|
|
+ "modulemd/v2/tests/test_data/f29.yaml"),
|
|
+ True)
|
|
+ module = idx.get_module('nodejs')
|
|
+
|
|
+ self.assertEquals(len(module.search_streams('8', 0)), 1)
|
|
+ self.assertEquals(len(module.search_streams('10', 0)), 1)
|
|
+
|
|
+
|
|
+if __name__ == '__main__':
|
|
+ unittest.main()
|
|
--
|
|
2.21.0
|
|
|