diff --git a/dvc/tree/gdrive.py b/dvc/tree/gdrive.py index 302a5ccda0..5e34fa4551 100644 --- a/dvc/tree/gdrive.py +++ b/dvc/tree/gdrive.py @@ -366,7 +366,10 @@ def _gdrive_upload_file( total=total, disable=no_progress_bar, ) as wrapped: - item.content = wrapped + # PyDrive doesn't like content property setting for empty files + # https://github.com/gsuitedevs/PyDrive/issues/121 + if total: + item.content = wrapped item.Upload() return item diff --git a/tests/func/test_data_cloud.py b/tests/func/test_data_cloud.py index 1fbaa70f06..c474935fd9 100644 --- a/tests/func/test_data_cloud.py +++ b/tests/func/test_data_cloud.py @@ -19,7 +19,17 @@ from dvc.utils.fs import move, remove from dvc.utils.serialize import dump_yaml, load_yaml -from .test_api import all_clouds +all_clouds = [ + pytest.lazy_fixture(cloud) + for cloud in ["s3", "gs", "azure", "gdrive", "ssh", "http"] +] + [ + pytest.param( + pytest.lazy_fixture("oss"), + marks=pytest.mark.xfail( + reason="https://github.com/iterative/dvc/issues/4633", + ), + ) +] @pytest.mark.parametrize("remote", all_clouds, indirect=True) @@ -35,6 +45,7 @@ def test_cloud(tmp_dir, dvc, remote): # pylint:disable=unused-argument "data_dir": { "data_sub_dir": {"data_sub": "data_sub"}, "data": "data", + "empty": "", } } ) @@ -128,6 +139,7 @@ def test_cloud_cli(tmp_dir, dvc, remote): "data_dir": { "data_sub_dir": {"data_sub": "data_sub"}, "data": "data", + "empty": "", } } )