🐛 pmgr: Fix error detection

Errors during install, e.g. due to dependency issues, that
happened while a "Requirement already installed" message
was present in the output as well, were wrongly read as
a "reinstall needed" case if there was no failure line
present for some reason.

The logic has now been adjusted so that a reinstall will
only be triggered if there was no `Error:` line in the
output. A test case has been added as well.

Closes #4703
This commit is contained in:
Gina Häußge committed 2023-01-23 16:29:48 +01:00
1 parent 7c42913205
commit 923c2e14be
3 files changed
+27 -3

No files matched your search

@@ -0,0 +1,18 @@
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing /tmp/tmprvq8z421.zip
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Requirement already satisfied: OctoPrint in /home/pi/oprint/lib/python3.9/site-packages (from OctoEverywhere==1.11.2) (1.8.6)
Requirement already satisfied: certifi in /home/pi/oprint/lib/python3.9/site-packages (from OctoEverywhere==1.11.2) (2022.9.24)
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x75453a30>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/dnspython/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x754a4a18>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/dnspython/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x754a4568>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/dnspython/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x754a4028>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/dnspython/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x754a4be0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/dnspython/
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x75453c40>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/dnspython/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x75453d90>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/dnspython/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x75453e80>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/dnspython/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x75453f70>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/dnspython/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPSConnection object at 0x75453fe8>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution')': /simple/dnspython/
ERROR: Could not find a version that satisfies the requirement dnspython (from octoeverywhere) (from versions: none)
ERROR: No matching distribution found for dnspython
+1
View File
@@ -165,6 +165,7 @@ class PipUtilTest(unittest.TestCase):
("already_installed_1.txt", True),
("already_installed_2.txt", True),
("successful_install_1.txt", False),
("dependency_error.txt", False),
)
@ddt.unpack
def test_is_already_installed(self, file, expected):