From 9e2510c0369c5bf6ae5b9cdfd294c731ebf52935 Mon Sep 17 00:00:00 2001 From: ggydush Date: Wed, 12 Jun 2024 11:11:52 -0700 Subject: [PATCH] test: Fix failing test cases Signed-off-by: ggydush --- flytekit/types/file/file.py | 2 +- tests/flytekit/unit/core/test_flyte_file.py | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/flytekit/types/file/file.py b/flytekit/types/file/file.py index c36e1bb32a..a567db599d 100644 --- a/flytekit/types/file/file.py +++ b/flytekit/types/file/file.py @@ -435,7 +435,7 @@ def to_literal( f" specified. Since a simpler type was specified, we'll skip uploading!" ) should_upload = False - if ctx.execution_state.is_local_execution: + if ctx.execution_state.is_local_execution and python_val.remote_path is None: should_upload = False # Set the remote destination if one was given instead of triggering a random one below diff --git a/tests/flytekit/unit/core/test_flyte_file.py b/tests/flytekit/unit/core/test_flyte_file.py index 6e055ca399..a1f8dd63c0 100644 --- a/tests/flytekit/unit/core/test_flyte_file.py +++ b/tests/flytekit/unit/core/test_flyte_file.py @@ -205,7 +205,7 @@ def my_wf(fname: os.PathLike = SAMPLE_DATA) -> int: assert sample_lp.parameters.parameters["fname"].default.scalar.blob.uri == SAMPLE_DATA -def test_file_handling_local_file_gets_copied(): +def test_file_handling_local_file_does_not_get_copied(): @task def t1() -> FlyteFile: # Use this test file itself, since we know it exists. @@ -223,12 +223,7 @@ def my_wf() -> FlyteFile: assert len(top_level_files) == 1 # the flytekit_local folder x = my_wf() - - # After running, this test file should've been copied to the mock remote location. - mock_remote_files = os.listdir(os.path.join(random_dir, "mock_remote")) - assert len(mock_remote_files) == 1 # the file - # File should've been copied to the mock remote folder - assert x.path.startswith(random_dir) + assert x.path == __file__ def test_file_handling_local_file_gets_force_no_copy():