Skip to content

Commit

Permalink
testsuite: add python unit tests for conf_builtin_get()
Browse files Browse the repository at this point in the history
Problem: There are no unit tests for the Python interface to
flux_conf_builtin_get().

Add some very simple tests.
  • Loading branch information
grondo committed Dec 11, 2024
1 parent 23a7df7 commit 024e5cb
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions t/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions t/python/t0031-conf-builtin.py
Original file line number Diff line number Diff line change
@@ -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())

0 comments on commit 024e5cb

Please sign in to comment.