Give deps more time to run.
[python_utils.git] / tests / run_some_dependencies_test.py
1 #!/usr/bin/env python3
2
3 """This is a "test" that just runs a few system utilities that have
4 dependencies on this library in "do nothing" mode and makes sure they
5 exit cleanly.
6
7 """
8
9 import logging
10 import unittest
11 from typing import Optional
12
13 import bootstrap
14 import exec_utils
15 import unittest_utils
16
17 logger = logging.getLogger(__name__)
18
19
20 class RunSomeDependenciesTest(unittest.TestCase):
21     def test_make_sure_random_utilities_still_seem_to_work(self):
22         commands = [
23             "/home/scott/cron/manage_lights.py -n --run_profiler >& /dev/null",
24             "/home/scott/bin/reminder.py --logging_level=DEBUG >& /dev/null",
25             "/home/scott/bin/wordle.py --mode=AUTOPLAY --template=trial >& /dev/null",
26             "/home/scott/bin/tplink.py -a office_lights -c info --audit_import_events >& /dev/null",
27             "/home/scott/bin/unscramble.py ethyropadratoyzrhoiectmi --trace_memory >& /dev/null",
28             "/home/scott/bin/cron.py --command='sleep 0' --lockfile=/tmp/deleteme_lock >& /dev/null",
29             "/home/scott/cron/manage_switch_off_timers.py >& /dev/null",
30         ]
31         for command in commands:
32             try:
33                 ret = exec_utils.cmd_with_timeout(command, 10.0)
34                 self.assertEqual(0, ret)
35             except Exception as e:
36                 logger.exception(e)
37                 self.fail(f"{command} exited with an unexpected exception: {e}")
38
39
40 if __name__ == '__main__':
41     bootstrap.initialize(unittest.main)()