From c0e3ba565a4d2899c29fad85facd5a9f214022a2 Mon Sep 17 00:00:00 2001 From: Arkadiusz Kuczynski Date: Mon, 20 Nov 2023 12:30:07 +0100 Subject: [PATCH 1/4] [fix] zip file duplication bug --- ArchiveLibrary/keywords.py | 3 ++- atests/testcase.robot | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ArchiveLibrary/keywords.py b/ArchiveLibrary/keywords.py index 853aae0..1c771e3 100644 --- a/ArchiveLibrary/keywords.py +++ b/ArchiveLibrary/keywords.py @@ -130,7 +130,8 @@ def create_zip_from_files_in_directory(cls, directory, filename, sub_directories files = return_files_lists(directory, sub_directories) for filepath, name in files: - the_zip.write(filepath, arcname=name) + if name != os.path.basename(filename): + the_zip.write(filepath, arcname=name) the_zip.close() diff --git a/atests/testcase.robot b/atests/testcase.robot index 623fa05..3ccb923 100644 --- a/atests/testcase.robot +++ b/atests/testcase.robot @@ -105,6 +105,16 @@ Create ZIP Package from files in directory and subdirectory with no compression Archive Should Contain File ${zipfilename} subdir${/}file3.txt Remove File ${zipfilename} +Create ZIP Package from files in same directory as files + ${zipfilename}= set variable ${CURDIR}${/}FilesToTar${/}newZipFile.zip + Remove File ${zipfilename} + Create zip from Files in directory ${CURDIR}${/}FilesToTar ${zipfilename} + Archive Should Contain File ${zipfilename} file1.txt + Archive Should Contain File ${zipfilename} file2.txt + Run Keyword And Expect Error *does not contain value 'newZipFile.zip'* Archive Should Contain File ${zipfilename} newZipFile.zip + Run Keyword And Expect Error *does not contain value 'subdir${/}file3.txt'* Archive Should Contain File ${zipfilename} subdir${/}file3.txt + Remove File ${zipfilename} + Create ZIP Package from files in directory and subdirectory with compression deflated ${zipfilename}= set variable newZipFile.zip Remove File ${zipfilename} From 149a3bab6e590f3f127ffa302faa8de0d84407bc Mon Sep 17 00:00:00 2001 From: Luca Giovenzana Date: Sat, 26 Oct 2024 17:38:01 +0200 Subject: [PATCH 2/4] doc: add CONTRIBUTING.md guidelines --- CONTRIBUTING.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..cac5815 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,51 @@ +# How to contribute + +## Setup a development environment + +1) First of all make sure to have a 3.x python version installed +2) Clone the source code: + `git@github.com:MarketSquare/robotframework-archivelibrary.git` +3) I suggest to create a python virtual environment: +```sh + cd robotframework-requests/ + python -m venv venv + source venv/bin/activate +``` +4) Install the library in editing mode and all the test dependencies: + `python -m pip install -e` +5) Run acceptance tests with robot: + `robot ./atests` +6) Run unit tests wiht pytest: + `pytest ./utests` + +If everything went well now you're ready to go! + +## Coding guidelines + +Many checks and tests are automatically performed in Continuous Integration with the +GitHub Actions. + +Have a look at the file `.github/workflows/python-app.yml` to see the commands used. + +#### Linting + +The project uses flake8 for linting the source code. + +#### Unit tests + +PyTest is integrated for unit tests that located in `utests/` folder. + +#### Acceptance tests + +Obviously for acceptance tests Robot Framework is used, files are located in `atests/`. + +#### Test Coverage + +Test coverage is evaluated for unit and acceptance tests, after test execution +`coverage report` command shows you the statistics. + +#### Documentation + +Keywords documentation (on Linux) can be updated running the following script: + +`doc/generate_doc.sh` From d27f5255c225dc56bec0b9b75d39dfddb64184e6 Mon Sep 17 00:00:00 2001 From: Luca Giovenzana Date: Sat, 26 Oct 2024 17:41:42 +0200 Subject: [PATCH 3/4] doc: generate doc --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 70e0c78..8c54446 100644 --- a/index.html +++ b/index.html @@ -1190,7 +1190,7 @@ jQuery.extend({highlight:function(e,t,n,r){if(e.nodeType===3){var i=e.data.match(t);if(i){var s=document.createElement(n||"span");s.className=r||"highlight";var o=e.splitText(i.index);o.splitText(i[0].length);var u=o.cloneNode(true);s.appendChild(u);o.parentNode.replaceChild(s,o);return 1}}else if(e.nodeType===1&&e.childNodes&&!/(script|style)/i.test(e.tagName)&&!(e.tagName===n.toUpperCase()&&e.className===r)){for(var a=0;a From 02fa27eedb4307badb25d036358ddbbe4894ca8e Mon Sep 17 00:00:00 2001 From: Luca Giovenzana Date: Sat, 26 Oct 2024 17:42:25 +0200 Subject: [PATCH 4/4] build: bump up version to 0.4.3 --- ArchiveLibrary/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArchiveLibrary/version.py b/ArchiveLibrary/version.py index 1376913..c42de8a 100644 --- a/ArchiveLibrary/version.py +++ b/ArchiveLibrary/version.py @@ -1 +1 @@ -VERSION = '0.4.2' +VERSION = '0.4.3'