Easier and more self documenting patterns for loading/saving Persistent
[python_utils.git] / tests / run_some_dependencies_test.py
1 #!/usr/bin/env python3
2
3 # © Copyright 2021-2022, Scott Gasch
4
5 """This is a "test" that just runs a few system utilities that have
6 dependencies on this library in "do nothing" mode and makes sure they
7 exit cleanly.
8
9 """
10
11 import logging
12 import unittest
13
14 import bootstrap
15 import exec_utils
16 import unittest_utils
17
18 logger = logging.getLogger(__name__)
19
20
21 class RunSomeDependenciesTest(unittest.TestCase):
22     def test_make_sure_random_utilities_still_seem_to_work(self):
23         commands = [
24             "echo your mom | indent_and_wrap.py --indent=2 --align=CENTER >& /dev/null",
25             "/home/scott/cron/manage_lights.py -n --run_profiler >& /dev/null",
26             "/home/scott/bin/reminder.py --logging_level=DEBUG >& /dev/null",
27             "/home/scott/bin/wordle.py --mode=AUTOPLAY --template=trial >& /dev/null",
28             "/home/scott/bin/tplink.py -a office_lights -c info --audit_import_events >& /dev/null",
29             "/home/scott/bin/unscramble.py ethyropadratoyzrhoiectmi --trace_memory >& /dev/null",
30             "/home/scott/bin/cron.py --command='sleep 0' --lockfile=/tmp/deleteme_lock >& /dev/null",
31             "/home/scott/cron/manage_switch_off_timers.py >& /dev/null",
32             "/home/scott/bin/smart_device.py cabin and outside and timeout:* -c print >& /dev/null",
33         ]
34         for command in commands:
35             try:
36                 ret = exec_utils.cmd_exitcode(command, 25.0)
37                 self.assertEqual(0, ret)
38             except Exception as e:
39                 logger.exception(e)
40                 self.fail(f"{command} exited with an unexpected exception: {e}")
41
42
43 if __name__ == '__main__':
44     bootstrap.initialize(unittest.main)()