2 new revisions:
Revision: 19e9d9e04dde
Branch: default
Author: Mikko Korpela <mikko.korp...@gmail.com>
Date: Tue Jan 28 12:57:27 2014 UTC
Log: OperatingSystem:Copy/Move Files: Destination must not be an
existing f...
http://code.google.com/p/robotframework/source/detail?r=19e9d9e04dde
Revision: 8d53dfa1e5cd
Branch: default
Author: Mikko Korpela <mikko.korp...@gmail.com>
Date: Tue Jan 28 13:10:41 2014 UTC
Log: OperatingSystem: Move/Copy Files: Destination is always a
directory an...
http://code.google.com/p/robotframework/source/detail?r=8d53dfa1e5cd
==============================================================================
Revision: 19e9d9e04dde
Branch: default
Author: Mikko Korpela <mikko.korp...@gmail.com>
Date: Tue Jan 28 12:57:27 2014 UTC
Log: OperatingSystem:Copy/Move Files: Destination must not be an
existing file
http://code.google.com/p/robotframework/source/detail?r=19e9d9e04dde
Modified:
/atest/robot/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt
/atest/testdata/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt
/src/robot/libraries/OperatingSystem.py
=======================================
---
/atest/robot/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt
Fri Jan 24 12:27:32 2014 UTC
+++
/atest/robot/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt
Tue Jan 28 12:57:27 2014 UTC
@@ -19,6 +19,12 @@
Copy File when destination is a directory and file with same name exists
Check testcase ${TESTNAME}
+
+Copy Files destination can not be an existing file
+ Check testcase ${TESTNAME}
+
+Move Files destination can not be an existing file
+ Check testcase ${TESTNAME}
Move File To Existing Dir
Check testcase ${TESTNAME}
=======================================
---
/atest/testdata/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt
Fri Jan 24 12:27:32 2014 UTC
+++
/atest/testdata/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt
Tue Jan 28 12:57:27 2014 UTC
@@ -259,6 +259,18 @@
[Teardown] Remove Test Files For Multifile Operations
Run Keyword And Expect Error Must contain destination and at least
one source Copy Files
+Copy Files destination can not be an existing file
+ [Setup] Create Test Files For Multifile Operations
+ [Teardown] Remove Test Files For Multifile Operations
+ Run Keyword And Expect Error Destination can not be an existing
file*
+ ... Copy Files ${SOURCE}movecopy_list-2.txt
${SOURCE}movecopy_list-1.txt
+
+Move Files destination can not be an existing file
+ [Setup] Create Test Files For Multifile Operations
+ [Teardown] Remove Test Files For Multifile Operations
+ Run Keyword And Expect Error Destination can not be an existing
file*
+ ... Move Files ${SOURCE}movecopy_list-2.txt
${SOURCE}movecopy_list-1.txt
+
Copy One File To File With Copy Files
[Setup] Create Test Files For Multifile Operations
[Teardown] Remove Test Files For Multifile Operations
=======================================
--- /src/robot/libraries/OperatingSystem.py Mon Jan 27 12:52:18 2014 UTC
+++ /src/robot/libraries/OperatingSystem.py Tue Jan 28 12:57:27 2014 UTC
@@ -795,6 +795,8 @@
def _prepare_list_of_source_files(self, destination, *sources):
destination, dest_is_dir = self._normalize_dest(destination)
+ if not dest_is_dir and os.path.isfile(destination):
+ raise RuntimeError("Destination can not be an existing
file '%s'" % destination)
source_files = []
for source in sources:
files_matching_pattern = glob.glob(source)
==============================================================================
Revision: 8d53dfa1e5cd
Branch: default
Author: Mikko Korpela <mikko.korp...@gmail.com>
Date: Tue Jan 28 13:10:41 2014 UTC
Log: OperatingSystem: Move/Copy Files: Destination is always a
directory and can not be used for rename operations
http://code.google.com/p/robotframework/source/detail?r=8d53dfa1e5cd
Modified:
/atest/robot/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt
/atest/testdata/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt
/src/robot/libraries/OperatingSystem.py
=======================================
---
/atest/robot/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt
Tue Jan 28 12:57:27 2014 UTC
+++
/atest/robot/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt
Tue Jan 28 13:10:41 2014 UTC
@@ -25,6 +25,12 @@
Move Files destination can not be an existing file
Check testcase ${TESTNAME}
+
+Copy Files directory will be created if it does not exist
+ Check testcase ${TESTNAME}
+
+Move Files directory will be created if it does not exist
+ Check testcase ${TESTNAME}
Move File To Existing Dir
Check testcase ${TESTNAME}
@@ -77,15 +83,6 @@
Moving Non-existing Files Fails
Check testcase ${TESTNAME}
-
-Rename One File With Move Files
- Check testcase ${TESTNAME}
-
-Rename Multiple Files To One File Fails
- Check testcase ${TESTNAME}
-
-Rename List of Files with Patterns To One File Fails
- Check testcase ${TESTNAME}
# Test cases for Copy Files keyword
Copy One File To Dir With Copy Files
@@ -102,9 +99,6 @@
Copy Multiple Files
Check testcase ${TESTNAME}
-
-Copy Multiple Files To One File Fails
- Check testcase ${TESTNAME}
Copy Multiple Files From Multiple Directories
Check testcase ${TESTNAME}
@@ -114,9 +108,6 @@
Copy List of Files with Patterns
Check testcase ${TESTNAME}
-
-Copy List of Files with Pattern To One File Fails
- Check testcase ${TESTNAME}
Copying Non-existing Files Fails
Check testcase ${TESTNAME}
=======================================
---
/atest/testdata/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt
Tue Jan 28 12:57:27 2014 UTC
+++
/atest/testdata/standard_libraries/operating_system/file_and_dir_moving_and_copying.txt
Tue Jan 28 13:10:41 2014 UTC
@@ -210,35 +210,6 @@
... Move Files ${SOURCE}non_existing.txt
${SOURCE}non_existing_pattern*.txt ${DEST}
Directory Should Be Empty ${DEST}
Directory Should Have Items ${SOURCE} @{source_files}
-
-Rename One File With Move Files
- [Setup] Create Test Files For Multifile Operations
- [Teardown] Remove Test Files For Multifile Operations
- Move Files ${SOURCE}${/}rename-*.txt ${SOURCE}renamed-one.txt
- Remove Values From List ${source_files}
- ... rename-one.txt
- Append To List ${source_files}
- ... renamed-one.txt
- Directory Should Have Items ${SOURCE} @{source_files}
-
-Rename Multiple Files To One File Fails
- [Setup] Create Test Files For Multifile Operations
- [Teardown] Remove Test Files For Multifile Operations
- Append To File ${SOURCE}rename_multi-1.txt one
- Append To File ${SOURCE}rename_multi-2.txt two
- Run Keyword And Expect Error Several files match the pattern*
- ... Move Files ${SOURCE}${/}rename_multi-[12].txt
${SOURCE}rename_multi-renamed.txt
- Directory Should Be Empty ${DEST}
- Directory Should Have Items ${SOURCE} @{source_files}
-
-Rename List of Files with Patterns To One File Fails
- [Setup] Create Test Files For Multifile Operations
- [Teardown] Remove Test Files For Multifile Operations
- Run Keyword And Expect Error Several files match the pattern*
- ... Move Files ${SOURCE}rename_list_pattern3-*.txt
${SOURCE}rename_list_pattern4-?.txt
- ... ${SOURCE}renamed_list_pattern.txt
- Directory Should Be Empty ${DEST}
- Directory Should Have Items ${SOURCE} @{source_files}
# Test cases for Copy Files keyword
Copy One File To Dir With Copy Files
@@ -271,6 +242,18 @@
Run Keyword And Expect Error Destination can not be an existing
file*
... Move Files ${SOURCE}movecopy_list-2.txt
${SOURCE}movecopy_list-1.txt
+Copy Files directory will be created if it does not exist
+ [Setup] Create Test Files For Multifile Operations
+ [Teardown] Remove Test Files For Multifile Operations
+ Copy Files ${SOURCE}movecopy_list-1.txt ${DEST}copieddir
+ Directory Should Have Items ${DEST}copieddir movecopy_list-1.txt
+
+Move Files directory will be created if it does not exist
+ [Setup] Create Test Files For Multifile Operations
+ [Teardown] Remove Test Files For Multifile Operations
+ Move Files ${SOURCE}movecopy_list-1.txt ${DEST}moveddir
+ Directory Should Have Items ${DEST}moveddir movecopy_list-1.txt
+
Copy One File To File With Copy Files
[Setup] Create Test Files For Multifile Operations
[Teardown] Remove Test Files For Multifile Operations
@@ -287,14 +270,6 @@
... movecopy_multi-1.txt
... movecopy_multi-2.txt
Directory Should Have Items ${SOURCE} @{source_files}
-
-Copy Multiple Files To One File Fails
- [Setup] Create Test Files For Multifile Operations
- [Teardown] Remove Test Files For Multifile Operations
- Run Keyword And Expect Error Several files match the pattern*
- ... Copy Files ${SOURCE}${/}movecopy_multi-[12].txt
${DEST}copied_multi.txt
- Directory Should Be Empty ${DEST}
- Directory Should Have Items ${SOURCE} @{source_files}
Copy Multiple Files From Multiple Directories
[Setup] Create Test Files For Multifile Operations
@@ -331,15 +306,6 @@
... movecopy_list_pattern2-3.txt
... movecopy_list_pattern2-4.txt
Directory Should Have Items ${SOURCE} @{source_files}
-
-Copy List of Files with Pattern To One File Fails
- [Setup] Create Test Files For Multifile Operations
- [Teardown] Remove Test Files For Multifile Operations
- Run Keyword And Expect Error Several files match the pattern*
- ... Copy Files ${SOURCE}movecopy_list_pattern-*.txt
${SOURCE}movecopy_list_pattern2-?.txt
- ... ${DEST}copied_list_pattern.txt
- Directory Should Be Empty ${DEST}
- Directory Should Have Items ${SOURCE} @{source_files}
Copying Non-existing Files Fails
[Setup] Create Test Files For Multifile Operations
=======================================
--- /src/robot/libraries/OperatingSystem.py Tue Jan 28 12:57:27 2014 UTC
+++ /src/robot/libraries/OperatingSystem.py Tue Jan 28 13:10:41 2014 UTC
@@ -797,12 +797,11 @@
destination, dest_is_dir = self._normalize_dest(destination)
if not dest_is_dir and os.path.isfile(destination):
raise RuntimeError("Destination can not be an existing
file '%s'" % destination)
+ if not os.path.isdir(destination):
+ os.makedirs(destination)
source_files = []
for source in sources:
- files_matching_pattern = glob.glob(source)
- if len(files_matching_pattern) > 1 and not dest_is_dir:
- raise RuntimeError("Several files match the pattern '%s'
and will overwrite the single destination file." % source)
- source_files.extend(files_matching_pattern)
+ source_files.extend(glob.glob(source))
return source_files
def _prepare_for_move_or_copy(self, source, dest):
--
---
You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.