Merge patch 1.5.5 (#955)

* Remove os.path.commonpath call (Issue #954)
* Bump version and update changelog and release notes
This commit is contained in:
Veronica Berglyd Olsen
2022-01-05 16:24:34 +01:00
committed by GitHub
parent 00b3c3e9d2
commit c1c6a370a5
4 changed files with 32 additions and 10 deletions
+18
View File
@@ -91,6 +91,24 @@ final release.
---- ----
## Version 1.5.5 [2022-01-05]
### Release Notes
This is a bugfix release that fixes an issues with the backup tool crashing the app if the project
path and backup path are on different drive locations. This issue only affects Windows.
### Detailed Changelog
**Bugfixes**
* Fixed a bug with using the commonpath command in Python which will raise an error if the two
paths don't have a common root. This is particularly an issue on Windows where the paths can be
on different drives. The command was used in the project backup function, and has now been
replaced by a safer check. Issue #954.
----
## Version 1.5.4 [2022-01-04] ## Version 1.5.4 [2022-01-04]
### Release Notes ### Release Notes
+1 -1
View File
@@ -827,7 +827,7 @@ class NWProject():
), nwAlert.ERROR, exception=exc) ), nwAlert.ERROR, exception=exc)
return False return False
if os.path.commonpath([self.projPath, baseDir]) == self.projPath: if baseDir and baseDir.startswith(self.projPath):
self.theParent.makeAlert(self.tr( self.theParent.makeAlert(self.tr(
"Cannot backup project because the backup path is within the " "Cannot backup project because the backup path is within the "
"project folder to be backed up. Please choose a different " "project folder to be backed up. Please choose a different "
+1 -1
View File
@@ -7,7 +7,7 @@
<author>Jay Doh</author> <author>Jay Doh</author>
<saveCount>1267</saveCount> <saveCount>1267</saveCount>
<autoCount>198</autoCount> <autoCount>198</autoCount>
<editTime>62103</editTime> <editTime>62543</editTime>
</project> </project>
<settings> <settings>
<doBackup>False</doBackup> <doBackup>False</doBackup>
+12 -8
View File
@@ -1223,26 +1223,30 @@ def testCoreProject_Backup(monkeypatch, mockGUI, nwMinimal, tmpDir):
# No project # No project
mockGUI.hasProject = False mockGUI.hasProject = False
assert not theProject.zipIt(doNotify=False) assert theProject.zipIt(doNotify=False) is False
mockGUI.hasProject = True mockGUI.hasProject = True
# Invalid path # Invalid path
theProject.mainConf.backupPath = None theProject.mainConf.backupPath = None
assert not theProject.zipIt(doNotify=False) assert theProject.zipIt(doNotify=False) is False
# Missing project name # Missing project name
theProject.mainConf.backupPath = tmpDir theProject.mainConf.backupPath = tmpDir
theProject.projName = "" theProject.projName = ""
assert not theProject.zipIt(doNotify=False) assert theProject.zipIt(doNotify=False) is False
# Non-existent folder # Non-existent folder
theProject.mainConf.backupPath = os.path.join(tmpDir, "nonexistent") theProject.mainConf.backupPath = os.path.join(tmpDir, "nonexistent")
theProject.projName = "Test Minimal" theProject.projName = "Test Minimal"
assert not theProject.zipIt(doNotify=False) assert theProject.zipIt(doNotify=False) is False
# Same folder as project (causes infinite loop in zipping) # Same folder as project (causes infinite loop in zipping)
theProject.mainConf.backupPath = nwMinimal theProject.mainConf.backupPath = nwMinimal
assert not theProject.zipIt(doNotify=False) assert theProject.zipIt(doNotify=False) is False
# Subfolder of project (causes infinite loop in zipping)
theProject.mainConf.backupPath = os.path.join(nwMinimal, "subdir")
assert theProject.zipIt(doNotify=False) is False
# Set a valid folder # Set a valid folder
theProject.mainConf.backupPath = tmpDir theProject.mainConf.backupPath = tmpDir
@@ -1250,15 +1254,15 @@ def testCoreProject_Backup(monkeypatch, mockGUI, nwMinimal, tmpDir):
# Can't make folder # Can't make folder
with monkeypatch.context() as mp: with monkeypatch.context() as mp:
mp.setattr("os.mkdir", causeOSError) mp.setattr("os.mkdir", causeOSError)
assert not theProject.zipIt(doNotify=False) assert theProject.zipIt(doNotify=False) is False
# Can't write archive # Can't write archive
with monkeypatch.context() as mp: with monkeypatch.context() as mp:
mp.setattr("shutil.make_archive", causeOSError) mp.setattr("shutil.make_archive", causeOSError)
assert not theProject.zipIt(doNotify=False) assert theProject.zipIt(doNotify=False) is False
# Test correct settings # Test correct settings
assert theProject.zipIt(doNotify=True) assert theProject.zipIt(doNotify=True) is True
theFiles = os.listdir(os.path.join(tmpDir, "Test Minimal")) theFiles = os.listdir(os.path.join(tmpDir, "Test Minimal"))
assert len(theFiles) == 1 assert len(theFiles) == 1