gromero commented on a change in pull request #9663:
URL: https://github.com/apache/tvm/pull/9663#discussion_r764787623



##########
File path: tests/micro/common/test_tvmc.py
##########
@@ -75,8 +75,10 @@ def test_tvmc_model_build_only(board, output_dir):
     target, platform = _get_target_and_platform(board)
 
     if not os.path.isabs(output_dir):
-        output_dir = pathlib.Path(os.path.abspath(output_dir))
-        os.mkdir(output_dir)
+        out_dir_temp = os.path.abspath(output_dir)

Review comment:
       I think both `if`s (if `isabs()` and if  `isdir()`) in this part can be 
avoided by:
   
   ```
   diff --git a/tests/micro/common/test_tvmc.py 
b/tests/micro/common/test_tvmc.py
   index eb0b3a628..9de3d144b 100644
   --- a/tests/micro/common/test_tvmc.py
   +++ b/tests/micro/common/test_tvmc.py
   @@ -140,11 +140,9 @@ def test_tvmc_model_build_only(board, output_dir):
    def test_tvmc_model_run(board, output_dir):
        target, platform = _get_target_and_platform(board)
    
   -    if not os.path.isabs(output_dir):
   -        out_dir_temp = os.path.abspath(output_dir)
   -        if os.path.isdir(out_dir_temp):
   -            shutil.rmtree(out_dir_temp)
   -        os.mkdir(out_dir_temp)
   +    out_dir_temp = os.path.abspath(output_dir)
   +    shutil.rmtree(out_dir_temp, ignore_errors=True)
   +    os.mkdir(out_dir_temp)
    
        model_path = model_path = download_testdata(MODEL_URL, MODEL_FILE, 
module="data")
        tar_path = str(output_dir / "model.tar")
   ```
   
   But of course won't hold the patch for that. That could be done on a 
follow-on clean up.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to