1 line
23 KiB
JSON
1 line
23 KiB
JSON
{"created": 1755251399.5159278, "duration": 6.061098098754883, "exitcode": 1, "root": "/workspace/tligui_y/slic", "environment": {}, "summary": {"failed": 5, "total": 5, "collected": 5}, "collectors": [{"nodeid": "", "outcome": "passed", "result": [{"nodeid": "tests/test_utils_elog.py", "type": "Module"}]}, {"nodeid": "tests/test_utils_elog.py", "outcome": "passed", "result": [{"nodeid": "tests/test_utils_elog.py::test_get_default_elog_instance_with_direct_password_and_real_check", "type": "Function", "lineno": 12}, {"nodeid": "tests/test_utils_elog.py::test_get_default_elog_instance_with_wrong_password_and_real_check", "type": "Function", "lineno": 37}, {"nodeid": "tests/test_utils_elog.py::test_get_default_elog_instance_asks_password_and_opens", "type": "Function", "lineno": 46}, {"nodeid": "tests/test_utils_elog.py::test_get_default_elog_with_path_home", "type": "Function", "lineno": 72}, {"nodeid": "tests/test_utils_elog.py::test_screenshot", "type": "Function", "lineno": 121}]}], "tests": [{"nodeid": "tests/test_utils_elog.py::test_get_default_elog_instance_with_direct_password_and_real_check", "lineno": 12, "outcome": "failed", "keywords": ["test_get_default_elog_instance_with_direct_password_and_real_check", "test_utils_elog.py", "tests", "slic", ""], "setup": {"duration": 0.00044845882803201675, "outcome": "passed"}, "call": {"duration": 0.010856838896870613, "outcome": "failed", "crash": {"path": "/workspace/tligui_y/slic/tests/test_utils_elog.py", "lineno": 24, "message": "Failed: elog.open() raised an unexpected exception: Invalid username or password."}, "traceback": [{"path": "tests/test_utils_elog.py", "lineno": 24, "message": "Failed"}], "longrepr": "def test_get_default_elog_instance_with_direct_password_and_real_check():\n url = \"http://localhost:8080/demo\"\n user = \"robot\"\n password = \"testpassword\"\n text = \"This is a message1\"\n \n elog = Elog(\"http://localhost:8080/demo\", user=user, password=password)\n \n try:\n> elog.post(text)\n\ntests/test_utils_elog.py:22: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \nslic/utils/elog.py:17: in post\n return self._log.post(*args, **kwargs)\nslic/utils/logbook.py:273: in post\n resp_message, resp_headers, resp_msg_id = _validate_response(response)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nresponse = <Response [200]>\n\n def _validate_response(response):\n \"\"\" Validate response of the request.\"\"\"\n print(\"[DEBUG] _validate_response called\")\n print(f\" HTTP status code : {response.status_code}\")\n print(f\" Response headers : {response.headers}\")\n print(f\" First 300 bytes of content:\\n{response.content[:300]!r}\")\n \n msg_id = None\n \n if response.status_code not in [200, 302]:\n print(\"[DEBUG] Status not 200/302 \u2192 searching for <td class='errormsg'>\")\n err = re.findall('<td.*?class=\"errormsg\".*?>.*?</td>',\n response.content.decode('utf-8', 'ignore'),\n flags=re.DOTALL)\n if len(err) > 0:\n err = re.sub('(?:<.*?>)', '', err[0])\n print(f\"[DEBUG] Found error message: {err}\")\n if err:\n raise LogbookMessageRejected('Rejected because of: ' + err)\n else:\n raise LogbookMessageRejected('Rejected because of unknown error.')\n raise LogbookMessageRejected('Rejected because of unknown error.')\n else:\n location = response.headers.get('Location')\n if location is not None:\n print(f\"[DEBUG] Location header: {location}\")\n if 'has moved' in location:\n raise LogbookServerProblem('Logbook server has moved to another location.')\n elif 'fail' in location:\n raise LogbookAuthenticationError('Invalid username or password.')\n else:\n try:\n msg_id = int(urllib.parse.urlsplit(location).path.split('/')[-1])\n print(f\"[DEBUG] Parsed msg_id from Location: {msg_id}\")\n except ValueError:\n print(\"[DEBUG] Could not parse msg_id from Location\")\n msg_id = None\n \n if b'type=password' in response.content or b'type=\"password\"' in response.content:\n print(\"[DEBUG] Password input detected in response HTML \u2014 assuming login page \u2192 AUTH ERROR\")\n> raise LogbookAuthenticationError('Invalid username or password.')\nE slic.utils.logbook_exceptions.LogbookAuthenticationError: Invalid username or password.\n\nslic/utils/logbook.py:833: LogbookAuthenticationError\n\nDuring handling of the above exception, another exception occurred:\n\n def test_get_default_elog_instance_with_direct_password_and_real_check():\n url = \"http://localhost:8080/demo\"\n user = \"robot\"\n password = \"testpassword\"\n text = \"This is a message1\"\n \n elog = Elog(\"http://localhost:8080/demo\", user=user, password=password)\n \n try:\n elog.post(text)\n except Exception as e:\n> pytest.fail(f\"elog.open() raised an unexpected exception: {e}\")\nE Failed: elog.open() raised an unexpected exception: Invalid username or password.\n\ntests/test_utils_elog.py:24: Failed"}, "teardown": {"duration": 0.0003885440528392792, "outcome": "passed"}}, {"nodeid": "tests/test_utils_elog.py::test_get_default_elog_instance_with_wrong_password_and_real_check", "lineno": 37, "outcome": "failed", "keywords": ["test_get_default_elog_instance_with_wrong_password_and_real_check", "test_utils_elog.py", "tests", "slic", ""], "setup": {"duration": 0.00016534840688109398, "outcome": "passed"}, "call": {"duration": 0.0035166447050869465, "outcome": "failed", "crash": {"path": "/workspace/tligui_y/slic/tests/test_utils_elog.py", "lineno": 44, "message": "Failed: DID NOT RAISE <class 'elog.logbook_exceptions.LogbookAuthenticationError'>"}, "traceback": [{"path": "tests/test_utils_elog.py", "lineno": 44, "message": "Failed"}], "longrepr": "def test_get_default_elog_instance_with_wrong_password_and_real_check():\n url = \"http://localhost:8080/demo\"\n user = \"robot\"\n wrong_password = \"wrongpassword\"\n \n with pytest.raises(LogbookAuthenticationError):\n> Elog(url, user=user, password=wrong_password)\nE Failed: DID NOT RAISE <class 'elog.logbook_exceptions.LogbookAuthenticationError'>\n\ntests/test_utils_elog.py:44: Failed"}, "teardown": {"duration": 0.00023573683574795723, "outcome": "passed"}}, {"nodeid": "tests/test_utils_elog.py::test_get_default_elog_instance_asks_password_and_opens", "lineno": 46, "outcome": "failed", "keywords": ["test_get_default_elog_instance_asks_password_and_opens", "__wrapped__", "patchings", "test_utils_elog.py", "tests", "slic", ""], "setup": {"duration": 0.00013763364404439926, "outcome": "passed"}, "call": {"duration": 0.008206383790820837, "outcome": "failed", "crash": {"path": "/workspace/tligui_y/slic/tests/test_utils_elog.py", "lineno": 61, "message": "Failed: elog.open() raised an unexpected exception: Invalid username or password."}, "traceback": [{"path": "tests/test_utils_elog.py", "lineno": 61, "message": "Failed"}], "longrepr": "mock_home = <MagicMock name='home' id='139661723366688'>\nmock_getpass = <MagicMock name='getpass' id='139661724714032'>\n\n @patch(\"slic.utils.elog.getpass\")\n @patch(\"slic.utils.elog.Path.home\")\n def test_get_default_elog_instance_asks_password_and_opens(mock_home, mock_getpass):\n mock_home.return_value = Path(\"/does/not/exist\") # Fausse home \u2192 lecture \u00e9choue\n mock_getpass.return_value = \"testpassword\"\n user = \"robot\"\n text = \"This is a message2\"\n url = \"http://localhost:8080/demo\"\n \n elog = Elog(\"http://localhost:8080/demo\", user=user)\n \n try:\n> elog.post(text)\n\ntests/test_utils_elog.py:59: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \nslic/utils/elog.py:17: in post\n return self._log.post(*args, **kwargs)\nslic/utils/logbook.py:273: in post\n resp_message, resp_headers, resp_msg_id = _validate_response(response)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nresponse = <Response [200]>\n\n def _validate_response(response):\n \"\"\" Validate response of the request.\"\"\"\n print(\"[DEBUG] _validate_response called\")\n print(f\" HTTP status code : {response.status_code}\")\n print(f\" Response headers : {response.headers}\")\n print(f\" First 300 bytes of content:\\n{response.content[:300]!r}\")\n \n msg_id = None\n \n if response.status_code not in [200, 302]:\n print(\"[DEBUG] Status not 200/302 \u2192 searching for <td class='errormsg'>\")\n err = re.findall('<td.*?class=\"errormsg\".*?>.*?</td>',\n response.content.decode('utf-8', 'ignore'),\n flags=re.DOTALL)\n if len(err) > 0:\n err = re.sub('(?:<.*?>)', '', err[0])\n print(f\"[DEBUG] Found error message: {err}\")\n if err:\n raise LogbookMessageRejected('Rejected because of: ' + err)\n else:\n raise LogbookMessageRejected('Rejected because of unknown error.')\n raise LogbookMessageRejected('Rejected because of unknown error.')\n else:\n location = response.headers.get('Location')\n if location is not None:\n print(f\"[DEBUG] Location header: {location}\")\n if 'has moved' in location:\n raise LogbookServerProblem('Logbook server has moved to another location.')\n elif 'fail' in location:\n raise LogbookAuthenticationError('Invalid username or password.')\n else:\n try:\n msg_id = int(urllib.parse.urlsplit(location).path.split('/')[-1])\n print(f\"[DEBUG] Parsed msg_id from Location: {msg_id}\")\n except ValueError:\n print(\"[DEBUG] Could not parse msg_id from Location\")\n msg_id = None\n \n if b'type=password' in response.content or b'type=\"password\"' in response.content:\n print(\"[DEBUG] Password input detected in response HTML \u2014 assuming login page \u2192 AUTH ERROR\")\n> raise LogbookAuthenticationError('Invalid username or password.')\nE slic.utils.logbook_exceptions.LogbookAuthenticationError: Invalid username or password.\n\nslic/utils/logbook.py:833: LogbookAuthenticationError\n\nDuring handling of the above exception, another exception occurred:\n\nmock_home = <MagicMock name='home' id='139661723366688'>\nmock_getpass = <MagicMock name='getpass' id='139661724714032'>\n\n @patch(\"slic.utils.elog.getpass\")\n @patch(\"slic.utils.elog.Path.home\")\n def test_get_default_elog_instance_asks_password_and_opens(mock_home, mock_getpass):\n mock_home.return_value = Path(\"/does/not/exist\") # Fausse home \u2192 lecture \u00e9choue\n mock_getpass.return_value = \"testpassword\"\n user = \"robot\"\n text = \"This is a message2\"\n url = \"http://localhost:8080/demo\"\n \n elog = Elog(\"http://localhost:8080/demo\", user=user)\n \n try:\n elog.post(text)\n except Exception as e:\n> pytest.fail(f\"elog.open() raised an unexpected exception: {e}\")\nE Failed: elog.open() raised an unexpected exception: Invalid username or password.\n\ntests/test_utils_elog.py:61: Failed"}, "teardown": {"duration": 0.00027570314705371857, "outcome": "passed"}}, {"nodeid": "tests/test_utils_elog.py::test_get_default_elog_with_path_home", "lineno": 72, "outcome": "failed", "keywords": ["test_get_default_elog_with_path_home", "__wrapped__", "patchings", "test_utils_elog.py", "tests", "slic", ""], "setup": {"duration": 0.00014641927555203438, "outcome": "passed"}, "call": {"duration": 0.008691256400197744, "outcome": "failed", "crash": {"path": "/workspace/tligui_y/slic/tests/test_utils_elog.py", "lineno": 95, "message": "Failed: elog.open() raised an unexpected exception: Invalid username or password."}, "traceback": [{"path": "tests/test_utils_elog.py", "lineno": 95, "message": "Failed"}], "longrepr": "mock_home = <MagicMock name='home' id='139661723318448'>\nmock_getuser = <MagicMock name='getuser' id='139661723362208'>\nmock_getpass = <MagicMock name='getpass' id='139661723451344'>\n\n @patch(\"slic.utils.elog.getpass\")\n @patch(\"slic.utils.elog.getuser\")\n @patch(\"slic.utils.elog.Path.home\")\n def test_get_default_elog_with_path_home(mock_home, mock_getuser, mock_getpass):\n fake_user = \"robot\"\n fake_pw = \"testpassword\"\n mock_getuser.return_value = fake_user\n mock_getpass.return_value = fake_pw # fallback safety\n text = \"This is a message3\"\n url = \"http://localhost:8080/demo\"\n \n tmp_home = Path(\"/tmp/fake_home_for_robot\")\n tmp_home.mkdir(parents=True, exist_ok=True)\n pw_file = tmp_home / \".elog_psi\"\n pw_file.write_text(fake_pw)\n mock_home.return_value = tmp_home\n \n try:\n elog = Elog(\"http://localhost:8080/demo\")\n try:\n> elog.post(text)\n\ntests/test_utils_elog.py:93: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \nslic/utils/elog.py:17: in post\n return self._log.post(*args, **kwargs)\nslic/utils/logbook.py:273: in post\n resp_message, resp_headers, resp_msg_id = _validate_response(response)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nresponse = <Response [200]>\n\n def _validate_response(response):\n \"\"\" Validate response of the request.\"\"\"\n print(\"[DEBUG] _validate_response called\")\n print(f\" HTTP status code : {response.status_code}\")\n print(f\" Response headers : {response.headers}\")\n print(f\" First 300 bytes of content:\\n{response.content[:300]!r}\")\n \n msg_id = None\n \n if response.status_code not in [200, 302]:\n print(\"[DEBUG] Status not 200/302 \u2192 searching for <td class='errormsg'>\")\n err = re.findall('<td.*?class=\"errormsg\".*?>.*?</td>',\n response.content.decode('utf-8', 'ignore'),\n flags=re.DOTALL)\n if len(err) > 0:\n err = re.sub('(?:<.*?>)', '', err[0])\n print(f\"[DEBUG] Found error message: {err}\")\n if err:\n raise LogbookMessageRejected('Rejected because of: ' + err)\n else:\n raise LogbookMessageRejected('Rejected because of unknown error.')\n raise LogbookMessageRejected('Rejected because of unknown error.')\n else:\n location = response.headers.get('Location')\n if location is not None:\n print(f\"[DEBUG] Location header: {location}\")\n if 'has moved' in location:\n raise LogbookServerProblem('Logbook server has moved to another location.')\n elif 'fail' in location:\n raise LogbookAuthenticationError('Invalid username or password.')\n else:\n try:\n msg_id = int(urllib.parse.urlsplit(location).path.split('/')[-1])\n print(f\"[DEBUG] Parsed msg_id from Location: {msg_id}\")\n except ValueError:\n print(\"[DEBUG] Could not parse msg_id from Location\")\n msg_id = None\n \n if b'type=password' in response.content or b'type=\"password\"' in response.content:\n print(\"[DEBUG] Password input detected in response HTML \u2014 assuming login page \u2192 AUTH ERROR\")\n> raise LogbookAuthenticationError('Invalid username or password.')\nE slic.utils.logbook_exceptions.LogbookAuthenticationError: Invalid username or password.\n\nslic/utils/logbook.py:833: LogbookAuthenticationError\n\nDuring handling of the above exception, another exception occurred:\n\nmock_home = <MagicMock name='home' id='139661723318448'>\nmock_getuser = <MagicMock name='getuser' id='139661723362208'>\nmock_getpass = <MagicMock name='getpass' id='139661723451344'>\n\n @patch(\"slic.utils.elog.getpass\")\n @patch(\"slic.utils.elog.getuser\")\n @patch(\"slic.utils.elog.Path.home\")\n def test_get_default_elog_with_path_home(mock_home, mock_getuser, mock_getpass):\n fake_user = \"robot\"\n fake_pw = \"testpassword\"\n mock_getuser.return_value = fake_user\n mock_getpass.return_value = fake_pw # fallback safety\n text = \"This is a message3\"\n url = \"http://localhost:8080/demo\"\n \n tmp_home = Path(\"/tmp/fake_home_for_robot\")\n tmp_home.mkdir(parents=True, exist_ok=True)\n pw_file = tmp_home / \".elog_psi\"\n pw_file.write_text(fake_pw)\n mock_home.return_value = tmp_home\n \n try:\n elog = Elog(\"http://localhost:8080/demo\")\n try:\n elog.post(text)\n except Exception as e:\n> pytest.fail(f\"elog.open() raised an unexpected exception: {e}\")\nE Failed: elog.open() raised an unexpected exception: Invalid username or password.\n\ntests/test_utils_elog.py:95: Failed"}, "teardown": {"duration": 0.0002963128499686718, "outcome": "passed"}}, {"nodeid": "tests/test_utils_elog.py::test_screenshot", "lineno": 121, "outcome": "failed", "keywords": ["test_screenshot", "__wrapped__", "patchings", "test_utils_elog.py", "tests", "slic", ""], "setup": {"duration": 0.0001643570140004158, "outcome": "passed"}, "call": {"duration": 0.014081744942814112, "outcome": "failed", "crash": {"path": "/workspace/tligui_y/slic/slic/utils/logbook.py", "lineno": 833, "message": "slic.utils.logbook_exceptions.LogbookAuthenticationError: Invalid username or password."}, "traceback": [{"path": "tests/test_utils_elog.py", "lineno": 134, "message": ""}, {"path": "slic/utils/elog.py", "lineno": 22, "message": "in screenshot"}, {"path": "slic/utils/elog.py", "lineno": 17, "message": "in post"}, {"path": "slic/utils/logbook.py", "lineno": 273, "message": "in post"}, {"path": "slic/utils/logbook.py", "lineno": 833, "message": "LogbookAuthenticationError"}], "longrepr": "mock_screenshot_class = <MagicMock name='Screenshot' id='139661723371024'>\n\n @patch(\"slic.utils.elog.Screenshot\")\n def test_screenshot(mock_screenshot_class):\n fake_path = \"/tmp/fake_screenshot.png\"\n with open(fake_path, \"wb\") as f:\n f.write(b\"fake image data\")\n \n mock_instance = mock_screenshot_class.return_value\n mock_instance.shoot.return_value = [fake_path]\n \n elog = elog = Elog(\"http://localhost:8080/demo\", user=\"robot\", password=\"testpassword\")\n \n test_msg = \"SCREENSHOT_INTEGRATION_TEST_MSG_456\"\n> elog.screenshot(message=test_msg)\n\ntests/test_utils_elog.py:134: \n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \nslic/utils/elog.py:22: in screenshot\n self.post(message, **kwargs)\nslic/utils/elog.py:17: in post\n return self._log.post(*args, **kwargs)\nslic/utils/logbook.py:273: in post\n resp_message, resp_headers, resp_msg_id = _validate_response(response)\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ \n\nresponse = <Response [200]>\n\n def _validate_response(response):\n \"\"\" Validate response of the request.\"\"\"\n print(\"[DEBUG] _validate_response called\")\n print(f\" HTTP status code : {response.status_code}\")\n print(f\" Response headers : {response.headers}\")\n print(f\" First 300 bytes of content:\\n{response.content[:300]!r}\")\n \n msg_id = None\n \n if response.status_code not in [200, 302]:\n print(\"[DEBUG] Status not 200/302 \u2192 searching for <td class='errormsg'>\")\n err = re.findall('<td.*?class=\"errormsg\".*?>.*?</td>',\n response.content.decode('utf-8', 'ignore'),\n flags=re.DOTALL)\n if len(err) > 0:\n err = re.sub('(?:<.*?>)', '', err[0])\n print(f\"[DEBUG] Found error message: {err}\")\n if err:\n raise LogbookMessageRejected('Rejected because of: ' + err)\n else:\n raise LogbookMessageRejected('Rejected because of unknown error.')\n raise LogbookMessageRejected('Rejected because of unknown error.')\n else:\n location = response.headers.get('Location')\n if location is not None:\n print(f\"[DEBUG] Location header: {location}\")\n if 'has moved' in location:\n raise LogbookServerProblem('Logbook server has moved to another location.')\n elif 'fail' in location:\n raise LogbookAuthenticationError('Invalid username or password.')\n else:\n try:\n msg_id = int(urllib.parse.urlsplit(location).path.split('/')[-1])\n print(f\"[DEBUG] Parsed msg_id from Location: {msg_id}\")\n except ValueError:\n print(\"[DEBUG] Could not parse msg_id from Location\")\n msg_id = None\n \n if b'type=password' in response.content or b'type=\"password\"' in response.content:\n print(\"[DEBUG] Password input detected in response HTML \u2014 assuming login page \u2192 AUTH ERROR\")\n> raise LogbookAuthenticationError('Invalid username or password.')\nE slic.utils.logbook_exceptions.LogbookAuthenticationError: Invalid username or password.\n\nslic/utils/logbook.py:833: LogbookAuthenticationError"}, "teardown": {"duration": 0.00027164164930582047, "outcome": "passed"}}], "warnings": [{"message": "invalid escape sequence \\-", "category": "DeprecationWarning", "when": "collect", "filename": "/workspace/tligui_y/slic/.pixi/envs/default/lib/python3.8/site-packages/bsread/h5.py", "lineno": 207}, {"message": "The module numpy.dual is deprecated. Instead of using dual, use the functions directly from numpy or scipy.", "category": "DeprecationWarning", "when": "collect", "filename": "/workspace/tligui_y/slic/.pixi/envs/default/lib/python3.8/site-packages/scipy/fft/__init__.py", "lineno": 97}]} |