Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test: plugin_http_api_test correctly handle keeping logs when a test fails #1084

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions tests/plugin_http_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1619,10 +1619,7 @@ def setUpClass(self):

@classmethod
def tearDownClass(self):
global keepLogs
self.killNodes(self)
if unittest.TestResult().wasSuccessful() and not keepLogs:
self.cleanEnv(self)


if __name__ == "__main__":
Expand All @@ -1634,9 +1631,13 @@ def tearDownClass(self):
parser.add_argument('unittest_args', nargs=argparse.REMAINDER)

args = parser.parse_args()
global keepLogs
keepLogs = args.keep_logs;
keepLogs = args.keep_logs

# Now set the sys.argv to the unittest_args (leaving sys.argv[0] alone)
sys.argv[1:] = args.unittest_args
unittest.main()
suite = unittest.TestLoader().loadTestsFromTestCase(PluginHttpTest)
results = unittest.TextTestRunner().run(suite)
if not results.wasSuccessful():
keepLogs = True
if not keepLogs:
PluginHttpTest().cleanEnv()
Loading