From 6b36221b05f6aa7a054afc6017c39d0f15a65531 Mon Sep 17 00:00:00 2001 From: "Mark A. Grondona" Date: Fri, 6 Dec 2024 02:11:33 +0000 Subject: [PATCH] testsuite: add python unit tests for conf_builtin_get() Problem: There are no unit tests for the Python interface to flux_conf_builtin_get(). Add some very simple tests. --- t/Makefile.am | 1 + t/python/t0031-conf-builtin.py | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 t/python/t0031-conf-builtin.py diff --git a/t/Makefile.am b/t/Makefile.am index feb9b9e38c3e..2c05706d82e1 100644 --- a/t/Makefile.am +++ b/t/Makefile.am @@ -288,6 +288,7 @@ TESTSCRIPTS = \ python/t0028-compat36.py \ python/t0029-fileref.py \ python/t0030-journal.py \ + python/t0031-conf-builtin.py \ python/t1000-service-add-remove.py if HAVE_FLUX_SECURITY diff --git a/t/python/t0031-conf-builtin.py b/t/python/t0031-conf-builtin.py new file mode 100755 index 000000000000..14795efaae71 --- /dev/null +++ b/t/python/t0031-conf-builtin.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +############################################################### +# Copyright 2024 Lawrence Livermore National Security, LLC +# (c.f. AUTHORS, NOTICE.LLNS, COPYING) +# +# This file is part of the Flux resource manager framework. +# For details, see https://github.com/flux-framework. +# +# SPDX-License-Identifier: LGPL-3.0 +############################################################### + +import unittest + +import subflux # noqa: F401 +from flux.conf_builtin import conf_builtin_get +from pycotap import TAPTestRunner + + +class TestConfBuiltin(unittest.TestCase): + + def test_conf_builtin_get(self): + with self.assertRaises(ValueError): + conf_builtin_get("foo") + + with self.assertRaises(ValueError): + conf_builtin_get("confdir", which="badarg") + + self.assertIsNotNone(conf_builtin_get("confdir")) + self.assertIsNotNone(conf_builtin_get("confdir", which="intree")) + self.assertIsNotNone(conf_builtin_get("confdir", which="installed")) + + +if __name__ == "__main__": + unittest.main(testRunner=TAPTestRunner())