Skip to content

Commit

Permalink
Merge pull request #1084 from AntelopeIO/GH-1079-http-api-test
Browse files Browse the repository at this point in the history
Test: plugin_http_api_test correctly handle keeping logs when a test fails
  • Loading branch information
heifner authored Dec 19, 2024
2 parents 9a8dad3 + 708cfd5 commit dfacb07
Showing 1 changed file with 7 additions and 6 deletions.
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()

0 comments on commit dfacb07

Please sign in to comment.