22"""TODO: add more tests for API"""
33
44import os
5- from contextlib import contextmanager
5+ from contextlib import contextmanager , nullcontext
66from time import sleep
77from typing import Optional
88from unittest .mock import ANY , call , patch
@@ -509,7 +509,7 @@ def test_if_deprecate_with_delete_and_auto_push_then_invoke_git_push_tag(
509509def test_if_register_with_remote_repo_then_invoke_git_push_tag (tmp_dir : TmpDir ):
510510 with patch ("gto.registry.git_push_tag" ) as mocked_git_push_tag :
511511 with patch ("gto.git_utils.TemporaryDirectory" ) as MockedTemporaryDirectory :
512- MockedTemporaryDirectory .return_value = tmp_dir
512+ MockedTemporaryDirectory .return_value = nullcontext ( tmp_dir )
513513 gto .api .register (
514514 repo = tests .resources .SAMPLE_REMOTE_REPO_URL ,
515515 name = "model" ,
@@ -525,7 +525,7 @@ def test_if_register_with_remote_repo_then_invoke_git_push_tag(tmp_dir: TmpDir):
525525def test_if_assign_with_remote_repo_then_invoke_git_push_tag (tmp_dir : TmpDir ):
526526 with patch ("gto.registry.git_push_tag" ) as mocked_git_push_tag :
527527 with patch ("gto.git_utils.TemporaryDirectory" ) as MockedTemporaryDirectory :
528- MockedTemporaryDirectory .return_value = tmp_dir
528+ MockedTemporaryDirectory .return_value = nullcontext ( tmp_dir )
529529 gto .api .assign (
530530 repo = tests .resources .SAMPLE_REMOTE_REPO_URL ,
531531 name = "model" ,
@@ -550,7 +550,7 @@ def test_if_assign_with_remote_repo_then_invoke_git_push_tag(tmp_dir: TmpDir):
550550def test_if_deprecate_with_remote_repo_then_invoke_git_push_tag (tmp_dir : TmpDir ):
551551 with patch ("gto.registry.git_push_tag" ) as mocked_git_push_tag :
552552 with patch ("gto.git_utils.TemporaryDirectory" ) as MockedTemporaryDirectory :
553- MockedTemporaryDirectory .return_value = tmp_dir
553+ MockedTemporaryDirectory .return_value = nullcontext ( tmp_dir )
554554 gto .api .deprecate (
555555 repo = tests .resources .SAMPLE_REMOTE_REPO_URL ,
556556 name = "churn" ,
@@ -565,7 +565,7 @@ def test_if_deprecate_with_remote_repo_then_invoke_git_push_tag(tmp_dir: TmpDir)
565565def test_if_deregister_with_remote_repo_then_invoke_git_push_tag (tmp_dir : TmpDir ):
566566 with patch ("gto.registry.git_push_tag" ) as mocked_git_push_tag :
567567 with patch ("gto.git_utils.TemporaryDirectory" ) as MockedTemporaryDirectory :
568- MockedTemporaryDirectory .return_value = tmp_dir
568+ MockedTemporaryDirectory .return_value = nullcontext ( tmp_dir )
569569 gto .api .deregister (
570570 repo = tests .resources .SAMPLE_REMOTE_REPO_URL ,
571571 name = "churn" ,
@@ -581,7 +581,7 @@ def test_if_deregister_with_remote_repo_then_invoke_git_push_tag(tmp_dir: TmpDir
581581def test_if_unassign_with_remote_repo_then_invoke_git_push_tag (tmp_dir : TmpDir ):
582582 with patch ("gto.registry.git_push_tag" ) as mocked_git_push_tag :
583583 with patch ("gto.git_utils.TemporaryDirectory" ) as MockedTemporaryDirectory :
584- MockedTemporaryDirectory .return_value = tmp_dir
584+ MockedTemporaryDirectory .return_value = nullcontext ( tmp_dir )
585585 gto .api .unassign (
586586 repo = tests .resources .SAMPLE_REMOTE_REPO_URL ,
587587 name = "churn" ,
0 commit comments