|
| 1 | +import os |
| 2 | + |
| 3 | +from uipath._cli._utils._project_files import files_to_include |
| 4 | + |
| 5 | + |
| 6 | +class TestFilesToIncludeHiddenFiles: |
| 7 | + def test_hidden_files_are_excluded(self, tmp_path): |
| 8 | + project_dir = str(tmp_path) |
| 9 | + open(os.path.join(project_dir, "main.py"), "w").close() |
| 10 | + open(os.path.join(project_dir, ".hidden_file.py"), "w").close() |
| 11 | + open(os.path.join(project_dir, ".env"), "w").close() |
| 12 | + |
| 13 | + included, _ = files_to_include(None, project_dir, include_uv_lock=False) |
| 14 | + included_names = [f.file_name for f in included] |
| 15 | + |
| 16 | + assert "main.py" in included_names |
| 17 | + assert ".hidden_file.py" not in included_names |
| 18 | + assert ".env" not in included_names |
| 19 | + |
| 20 | + def test_hidden_files_in_subdirectory_are_excluded(self, tmp_path): |
| 21 | + project_dir = str(tmp_path) |
| 22 | + sub_dir = os.path.join(project_dir, "src") |
| 23 | + os.makedirs(sub_dir) |
| 24 | + open(os.path.join(sub_dir, "app.py"), "w").close() |
| 25 | + open(os.path.join(sub_dir, ".secret.json"), "w").close() |
| 26 | + |
| 27 | + included, _ = files_to_include(None, project_dir, include_uv_lock=False) |
| 28 | + included_names = [f.file_name for f in included] |
| 29 | + |
| 30 | + assert "app.py" in included_names |
| 31 | + assert ".secret.json" not in included_names |
0 commit comments