From 93bcf51257ec4ce2b97c942e51e56546ce8cd0cd Mon Sep 17 00:00:00 2001 From: Arif Ali Date: Mon, 15 Jan 2024 18:51:04 -0800 Subject: [testing] Add most testing via tox.ini Consolidate testing, so that things can be run from CLI, CI and various other means in a consistent way by using tox. * Updated all the flake8 tests in the tests folder. * Added pylint as a neutral test so that we can work on this in stages and have some collaboration on what we test and don't * The tox tests for unit, stageone, stagetwo testing makes is easier for users to know how to run tests, and not have to do things manually * Using tox for CI doesn't make sense, as that will create virtual envs and will disregard system/snap based python modules so may not work Signed-off-by: Arif Ali --- tests/report_tests/timeout/timeout_test.py | 1 - tests/report_tests/timeout/timeout_tests.py | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) (limited to 'tests/report_tests/timeout') diff --git a/tests/report_tests/timeout/timeout_test.py b/tests/report_tests/timeout/timeout_test.py index cfb148d7..8bc5ae61 100644 --- a/tests/report_tests/timeout/timeout_test.py +++ b/tests/report_tests/timeout/timeout_test.py @@ -15,7 +15,6 @@ class TimeoutTest(Plugin, IndependentPlugin): short_desc = 'Tests timeout functionality in test suite' plugin_timeout = 100 - def setup(self): self.add_cmd_output('sleep 15') self.add_cmd_output('echo I slept great', suggest_filename='echo_good') diff --git a/tests/report_tests/timeout/timeout_tests.py b/tests/report_tests/timeout/timeout_tests.py index 94117e8e..f18b7b38 100644 --- a/tests/report_tests/timeout/timeout_tests.py +++ b/tests/report_tests/timeout/timeout_tests.py @@ -50,9 +50,12 @@ class NativeCmdTimeoutTest(StageTwoReportTest): self.assertFileCollected('sos_commands/timeout_test/echo_good') def test_command_timed_out(self): - self.assertSosLogContains(r"\[plugin:timeout_test\] command 'sleep 30' timed out after 10s") + self.assertSosLogContains( + r"\[plugin:timeout_test\] command 'sleep 30' timed out after 10s" + ) self.assertFileCollected('sos_commands/timeout_test/sleep_30') + class MultipleTimeoutValues(NativeCmdTimeoutTest): """Test that our plugin timeout option priority is functioning correctly @@ -60,7 +63,8 @@ class MultipleTimeoutValues(NativeCmdTimeoutTest): """ install_plugins = ['timeout_test'] - sos_cmd = '-o timeout_test,host --plugin-timeout=30 -k timeout_test.timeout=60' + sos_cmd = ('-o timeout_test,host --plugin-timeout=30 -k ' + 'timeout_test.timeout=60') def test_correct_plugin_timeout(self): man = self.get_plugin_manifest('timeout_test') -- cgit