From 59a547870c6f7cdbc9982727b30221cfb4839c2b Mon Sep 17 00:00:00 2001 From: Aiden Grossman Date: Wed, 29 Jan 2025 07:56:02 +0000 Subject: [PATCH] Pass string to create_corpus_for_testing We use the TF test abstractions for the actual corpus tests, which is where I mostly copied the create_corpus_for_testing calls. Everything still works, but pytype in some environments will complain since absl test's create_tempdir() actually returns an internal _Tempdir object which is not equivalent to a string. Simply access the full_path property to get a string and make the type checker happy. --- compiler_opt/es/blackbox_evaluator_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler_opt/es/blackbox_evaluator_test.py b/compiler_opt/es/blackbox_evaluator_test.py index 8eca1bf0..bac38395 100644 --- a/compiler_opt/es/blackbox_evaluator_test.py +++ b/compiler_opt/es/blackbox_evaluator_test.py @@ -56,7 +56,7 @@ def test_trace_get_results(self): blackbox_test_utils.ESTraceWorker, count=3, arg='', kwarg='') as pool: perturbations = [b'00', b'01', b'10'] test_corpus = corpus.create_corpus_for_testing( - location=self.create_tempdir(), + location=self.create_tempdir().full_path, elements=[corpus.ModuleSpec(name='name1', size=1)]) evaluator = blackbox_evaluator.TraceBlackboxEvaluator( test_corpus, 5, 'fake_bb_trace_path', 'fake_function_index_path') @@ -68,7 +68,7 @@ def test_trace_set_baseline(self): with local_worker_manager.LocalWorkerPoolManager( blackbox_test_utils.ESTraceWorker, count=1, arg='', kwarg='') as pool: test_corpus = corpus.create_corpus_for_testing( - location=self.create_tempdir(), + location=self.create_tempdir().full_path, elements=[corpus.ModuleSpec(name='name1', size=1)]) evaluator = blackbox_evaluator.TraceBlackboxEvaluator( test_corpus, 5, 'fake_bb_trace_path', 'fake_function_index_path')