Skip to content

Commit

Permalink
test: Fix failing test cases
Browse files Browse the repository at this point in the history
Signed-off-by: ggydush <[email protected]>
  • Loading branch information
ggydush committed Jun 12, 2024
1 parent 9097e69 commit 9e2510c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion flytekit/types/file/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Check warning on line 439 in flytekit/types/file/file.py

View check run for this annotation

Codecov / codecov/patch

flytekit/types/file/file.py#L439

Added line #L439 was not covered by tests

# Set the remote destination if one was given instead of triggering a random one below
Expand Down
9 changes: 2 additions & 7 deletions tests/flytekit/unit/core/test_flyte_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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():
Expand Down

0 comments on commit 9e2510c

Please sign in to comment.