1 line
22 KiB
JSON
1 line
22 KiB
JSON
{"created": 1755176268.745499, "duration": 5.388128995895386, "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.00038378220051527023, "outcome": "passed"}, "call": {"duration": 0.008419505320489407, "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 \n msg_id = None\n \n if response.status_code not in [200, 302]:\n # 200 --> OK; 302 --> Found\n # Html page is returned with error description (handling errors same way as on original client. Looks\n # like there is no other way.\n \n err = re.findall('<td.*?class=\"errormsg\".*?>.*?</td>',\n response.content.decode('utf-8', 'ignore'),\n flags=re.DOTALL)\n \n if len(err) > 0:\n # Remove html tags\n # If part of the message has: Please go back... remove this part since it is an instruction for\n # the user when using browser.\n err = re.sub('(?:<.*?>)', '', err[0])\n if err:\n raise LogbookMessageRejected('Rejected because of: ' + err)\n else:\n raise LogbookMessageRejected('Rejected because of unknown error.')\n \n # Other unknown errors\n raise LogbookMessageRejected('Rejected because of unknown error.')\n else:\n location = response.headers.get('Location')\n if location is not None:\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 # returned locations is something like: '<host>/<sub_dir>/<logbook>/<msg_id><query>\n # with urllib.parse.urlparse returns attribute path=<sub_dir>/<logbook>/<msg_id>\n try:\n msg_id = int(urllib.parse.urlsplit(location).path.split('/')[-1])\n except ValueError as e:\n # it was not possible to get the msg_id.\n # this may happen when deleting the last entry of a logbook\n msg_id = None\n \n if b'type=password' in response.content or b'type=\"password\"' in response.content:\n # Not too smart to check this way, but no other indication of this kind of error.\n # C client does it the same way\n> raise LogbookAuthenticationError('Invalid username or password.')\nE slic.utils.logbook_exceptions.LogbookAuthenticationError: Invalid username or password.\n\nslic/utils/logbook.py:838: 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.000318730715662241, "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.000147978775203228, "outcome": "passed"}, "call": {"duration": 0.003355551976710558, "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.00018444331362843513, "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.00013840198516845703, "outcome": "passed"}, "call": {"duration": 0.007707403972744942, "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='140458853337840'>\nmock_getpass = <MagicMock name='getpass' id='140458847795616'>\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 \n msg_id = None\n \n if response.status_code not in [200, 302]:\n # 200 --> OK; 302 --> Found\n # Html page is returned with error description (handling errors same way as on original client. Looks\n # like there is no other way.\n \n err = re.findall('<td.*?class=\"errormsg\".*?>.*?</td>',\n response.content.decode('utf-8', 'ignore'),\n flags=re.DOTALL)\n \n if len(err) > 0:\n # Remove html tags\n # If part of the message has: Please go back... remove this part since it is an instruction for\n # the user when using browser.\n err = re.sub('(?:<.*?>)', '', err[0])\n if err:\n raise LogbookMessageRejected('Rejected because of: ' + err)\n else:\n raise LogbookMessageRejected('Rejected because of unknown error.')\n \n # Other unknown errors\n raise LogbookMessageRejected('Rejected because of unknown error.')\n else:\n location = response.headers.get('Location')\n if location is not None:\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 # returned locations is something like: '<host>/<sub_dir>/<logbook>/<msg_id><query>\n # with urllib.parse.urlparse returns attribute path=<sub_dir>/<logbook>/<msg_id>\n try:\n msg_id = int(urllib.parse.urlsplit(location).path.split('/')[-1])\n except ValueError as e:\n # it was not possible to get the msg_id.\n # this may happen when deleting the last entry of a logbook\n msg_id = None\n \n if b'type=password' in response.content or b'type=\"password\"' in response.content:\n # Not too smart to check this way, but no other indication of this kind of error.\n # C client does it the same way\n> raise LogbookAuthenticationError('Invalid username or password.')\nE slic.utils.logbook_exceptions.LogbookAuthenticationError: Invalid username or password.\n\nslic/utils/logbook.py:838: LogbookAuthenticationError\n\nDuring handling of the above exception, another exception occurred:\n\nmock_home = <MagicMock name='home' id='140458853337840'>\nmock_getpass = <MagicMock name='getpass' id='140458847795616'>\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.00022696703672409058, "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.00013768626376986504, "outcome": "passed"}, "call": {"duration": 0.00818039383739233, "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='140458846594624'>\nmock_getuser = <MagicMock name='getuser' id='140458846729648'>\nmock_getpass = <MagicMock name='getpass' id='140458845282208'>\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 \n msg_id = None\n \n if response.status_code not in [200, 302]:\n # 200 --> OK; 302 --> Found\n # Html page is returned with error description (handling errors same way as on original client. Looks\n # like there is no other way.\n \n err = re.findall('<td.*?class=\"errormsg\".*?>.*?</td>',\n response.content.decode('utf-8', 'ignore'),\n flags=re.DOTALL)\n \n if len(err) > 0:\n # Remove html tags\n # If part of the message has: Please go back... remove this part since it is an instruction for\n # the user when using browser.\n err = re.sub('(?:<.*?>)', '', err[0])\n if err:\n raise LogbookMessageRejected('Rejected because of: ' + err)\n else:\n raise LogbookMessageRejected('Rejected because of unknown error.')\n \n # Other unknown errors\n raise LogbookMessageRejected('Rejected because of unknown error.')\n else:\n location = response.headers.get('Location')\n if location is not None:\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 # returned locations is something like: '<host>/<sub_dir>/<logbook>/<msg_id><query>\n # with urllib.parse.urlparse returns attribute path=<sub_dir>/<logbook>/<msg_id>\n try:\n msg_id = int(urllib.parse.urlsplit(location).path.split('/')[-1])\n except ValueError as e:\n # it was not possible to get the msg_id.\n # this may happen when deleting the last entry of a logbook\n msg_id = None\n \n if b'type=password' in response.content or b'type=\"password\"' in response.content:\n # Not too smart to check this way, but no other indication of this kind of error.\n # C client does it the same way\n> raise LogbookAuthenticationError('Invalid username or password.')\nE slic.utils.logbook_exceptions.LogbookAuthenticationError: Invalid username or password.\n\nslic/utils/logbook.py:838: LogbookAuthenticationError\n\nDuring handling of the above exception, another exception occurred:\n\nmock_home = <MagicMock name='home' id='140458846594624'>\nmock_getuser = <MagicMock name='getuser' id='140458846729648'>\nmock_getpass = <MagicMock name='getpass' id='140458845282208'>\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.00022361986339092255, "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.0001718350686132908, "outcome": "passed"}, "call": {"duration": 0.007948626764118671, "outcome": "failed", "crash": {"path": "/workspace/tligui_y/slic/slic/utils/logbook.py", "lineno": 812, "message": "slic.utils.logbook_exceptions.LogbookMessageRejected: Rejected because of: Cannot write attachment file \"/root/elog_instance/logbooks/demo/2025/250814_125747_fake_screenshot.png\""}, "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": 812, "message": "LogbookMessageRejected"}], "longrepr": "mock_screenshot_class = <MagicMock name='Screenshot' id='140458846603824'>\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 [404]>\n\n def _validate_response(response):\n \"\"\" Validate response of the request.\"\"\"\n \n msg_id = None\n \n if response.status_code not in [200, 302]:\n # 200 --> OK; 302 --> Found\n # Html page is returned with error description (handling errors same way as on original client. Looks\n # like there is no other way.\n \n err = re.findall('<td.*?class=\"errormsg\".*?>.*?</td>',\n response.content.decode('utf-8', 'ignore'),\n flags=re.DOTALL)\n \n if len(err) > 0:\n # Remove html tags\n # If part of the message has: Please go back... remove this part since it is an instruction for\n # the user when using browser.\n err = re.sub('(?:<.*?>)', '', err[0])\n if err:\n> raise LogbookMessageRejected('Rejected because of: ' + err)\nE slic.utils.logbook_exceptions.LogbookMessageRejected: Rejected because of: Cannot write attachment file \"/root/elog_instance/logbooks/demo/2025/250814_125747_fake_screenshot.png\"\n\nslic/utils/logbook.py:812: LogbookMessageRejected"}, "teardown": {"duration": 0.00024084514006972313, "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}]} |