From 937099948216f74e53e77468afc87f84b9ccc844 Mon Sep 17 00:00:00 2001 From: "Salvador E. Tropea" Date: Thu, 10 Aug 2023 09:58:36 -0300 Subject: [PATCH] [Tests][Added] Support for Debian 12 pip --- tests/test_plot/test_dep_downloader.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/test_plot/test_dep_downloader.py b/tests/test_plot/test_dep_downloader.py index 87161038..08cc0f9f 100644 --- a/tests/test_plot/test_dep_downloader.py +++ b/tests/test_plot/test_dep_downloader.py @@ -156,7 +156,11 @@ def test_dep_python(test_dir, caplog, monkeypatch): try: import engineering_notation logging.debug('Test module is already installed, using pip to uninstall ...') - subprocess.run(['pip', 'uninstall', '-y', 'engineering-notation']) + cmd = ['pip', 'uninstall', '-y', 'engineering-notation'] + res = subprocess.run(cmd, capture_output=True) + if res.returncode == 1 and b'externally-managed-environment' in res.stderr: + cmd.insert(-1, '--break-system-packages') + res = subprocess.run(cmd, capture_output=True) # Why pip does this???!!! dir_name = os.path.dirname(engineering_notation.__file__) if os.path.isdir(dir_name):