Repository: alibaba/feathub (language: python)

Issue:
Unstable unit test
Feathub unit test occasionally fails with the following exception:

https://github.com/lindong28/feathub/actions/runs/3307702206/jobs/5459525283

<img width="1101" alt="image" src="https://user-images.githubusercontent.com/12155662/197436501-d8b593ba-5a93-448b-bff5-49884997b6dd.png">
Update nightly-build workflow so that it does not report error if nightly build already exists
Currently nightly build workflow can be triggered either manually or triggered by the daily schedule. If it has been triggered manually, the daily scheduled execution will fail due to "File already exists" error, which leads to unnecessary inconvenience for developers.

It might be better to use avoid this situation by using Test PyPI to perform and check the upload first. See https://pypi.org/help/#file-name-reuse for more detail.


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/publish-wheel.yaml b/.github/workflows/publish-wheel.yaml
index f32741f3..3d2fe15b 100644
--- a/.github/workflows/publish-wheel.yaml
+++ b/.github/workflows/publish-wheel.yaml
@@ -19,4 +19,4 @@ jobs:
           path: ./wheels
       - name: Upload Feathub package
         run: |
-          twine upload --username=${{ secrets.PYPI_REPOSITORY_USERNAME }} --password=${{ secrets.PYPI_REPOSITORY_PASSWORD }} wheels/*
+          twine upload --skip-existing --username=${{ secrets.PYPI_REPOSITORY_USERNAME }} --password=${{ secrets.PYPI_REPOSITORY_PASSWORD }} wheels/*


Test patch:
diff --git a/python/feathub/processors/flink/table_builder/tests/table_builder_test_base.py b/python/feathub/processors/flink/table_builder/tests/table_builder_test_base.py
index 3ad3830c..c7fdaced 100644
--- a/python/feathub/processors/flink/table_builder/tests/table_builder_test_base.py
+++ b/python/feathub/processors/flink/table_builder/tests/table_builder_test_base.py
@@ -70,7 +70,8 @@ def _create_file_source(
         timestamp_format: str = "%Y-%m-%d %H:%M:%S",
         schema: Optional[Schema] = None,
     ) -> FileSystemSource:
-        path = tempfile.NamedTemporaryFile(dir=self.temp_dir).name
+        # Add suffix so that it is not inferred with compression, e.g. xz, zip, etc.
+        path = tempfile.NamedTemporaryFile(dir=self.temp_dir).name + ".csv"
         df.to_csv(path, index=False, header=False)
         return FileSystemSource(
             f"source_{str(uuid.uuid4()).replace('-', '')}_table",