Clone
1
run 2247 TEST commit 73b2a08
ci-bot edited this page 2025-08-14 12:49:48 +00:00

Test Report

View CI Run 2247 | Commit 73b2a08

🧪 Test Report

Generated on 2025-08-14 14:49:25 CEST

🧾 General Info

  • duration: 5.337241172790527
  • root: /workspace/tligui_y/slic
  • environment: {}

📋 Summary

  • Failed: 5
  • Total: 5
  • Collected: 5

🔎 Tests

Failed (5)
  • 📄 test_utils_elog.py

    Function: test_get_default_elog_instance_with_direct_password_and_real_check

    • Test 1

      📌 Setup phase

      duration:

      0.0003820667043328285
      

      outcome:

      passed
      

      📌 Call phase

      duration:

      0.008483447134494781
      

      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():
              url = "http://localhost:8080/demo"
              user = "robot"
              password = "testpassword"
              text = "This is a message1"
      
              elog = Elog("http://localhost:8080/demo", user=user, password=password)
      
              try:
      >           elog.post(text)
      
      tests/test_utils_elog.py:22: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      slic/utils/elog.py:17: in post
          return self._log.post(*args, **kwargs)
      slic/utils/logbook.py:273: in post
          resp_message, resp_headers, resp_msg_id = _validate_response(response)
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      
      response = <Response [200]>
      
          def _validate_response(response):
              """ Validate response of the request."""
      
              msg_id = None
      
              if response.status_code not in [200, 302]:
                  # 200 --> OK; 302 --> Found
                  # Html page is returned with error description (handling errors same way as on original client. Looks
                  # like there is no other way.
      
                  err = re.findall('<td.*?class="errormsg".*?>.*?</td>',
                                   response.content.decode('utf-8', 'ignore'),
                                   flags=re.DOTALL)
      
                  if len(err) > 0:
                      # Remove html tags
                      # If part of the message has: Please go  back... remove this part since it is an instruction for
                      # the user when using browser.
                      err = re.sub('(?:<.*?>)', '', err[0])
                      if err:
                          raise LogbookMessageRejected('Rejected because of: ' + err)
                      else:
                          raise LogbookMessageRejected('Rejected because of unknown error.')
      
                  # Other unknown errors
                  raise LogbookMessageRejected('Rejected because of unknown error.')
              else:
                  location = response.headers.get('Location')
                  if location is not None:
                      if 'has moved' in location:
                          raise LogbookServerProblem('Logbook server has moved to another location.')
                      elif 'fail' in location:
                          raise LogbookAuthenticationError('Invalid username or password.')
                      else:
                          # returned locations is something like: '<host>/<sub_dir>/<logbook>/<msg_id><query>
                          # with urllib.parse.urlparse returns attribute path=<sub_dir>/<logbook>/<msg_id>
                          try:
                              msg_id = int(urllib.parse.urlsplit(location).path.split('/')[-1])
                          except ValueError as e:
                              # it was not possible to get the msg_id.
                              # this may happen when deleting the last entry of a logbook
                              msg_id = None
      
                  if b'type=password' in response.content or b'type="password"' in response.content:
                      # Not too smart to check this way, but no other indication of this kind of error.
                      # C client does it the same way
      >               raise LogbookAuthenticationError('Invalid username or password.')
      E               slic.utils.logbook_exceptions.LogbookAuthenticationError: Invalid username or password.
      
      slic/utils/logbook.py:838: LogbookAuthenticationError
      
      During handling of the above exception, another exception occurred:
      
          def test_get_default_elog_instance_with_direct_password_and_real_check():
              url = "http://localhost:8080/demo"
              user = "robot"
              password = "testpassword"
              text = "This is a message1"
      
              elog = Elog("http://localhost:8080/demo", user=user, password=password)
      
              try:
                  elog.post(text)
              except Exception as e:
      >           pytest.fail(f"elog.open() raised an unexpected exception: {e}")
      E           Failed: elog.open() raised an unexpected exception: Invalid username or password.
      
      tests/test_utils_elog.py:24: Failed
      

      📌 Teardown phase

      duration:

      0.0003162031061947346
      

      outcome:

      passed
      

    Function: test_get_default_elog_instance_with_wrong_password_and_real_check

    • Test 2

      📌 Setup phase

      duration:

      0.00013658776879310608
      

      outcome:

      passed
      

      📌 Call phase

      duration:

      0.006554971914738417
      

      outcome:

      failed
      

      crash:

      path: /workspace/tligui_y/slic/slic/utils/logbook.py
      lineno: 838
      message: slic.utils.logbook_exceptions.LogbookAuthenticationError: Invalid username or password.
      

      traceback:

      -   path: tests/test_utils_elog.py
        lineno: 46
        message: None
      -   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: 838
        message: LogbookAuthenticationError
      

      longrepr:

      def test_get_default_elog_instance_with_wrong_password_and_real_check():
              url = "http://localhost:8080/demo"
              user = "robot"
              wrong_password = "wrongpassword"
      
              elog = Elog(url, user=user, password=wrong_password)
      
              with pytest.raises(LogbookAuthenticationError):
      >           elog.post("This should fail due to wrong password")
      
      tests/test_utils_elog.py:46: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      slic/utils/elog.py:17: in post
          return self._log.post(*args, **kwargs)
      slic/utils/logbook.py:273: in post
          resp_message, resp_headers, resp_msg_id = _validate_response(response)
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      
      response = <Response [200]>
      
          def _validate_response(response):
              """ Validate response of the request."""
      
              msg_id = None
      
              if response.status_code not in [200, 302]:
                  # 200 --> OK; 302 --> Found
                  # Html page is returned with error description (handling errors same way as on original client. Looks
                  # like there is no other way.
      
                  err = re.findall('<td.*?class="errormsg".*?>.*?</td>',
                                   response.content.decode('utf-8', 'ignore'),
                                   flags=re.DOTALL)
      
                  if len(err) > 0:
                      # Remove html tags
                      # If part of the message has: Please go  back... remove this part since it is an instruction for
                      # the user when using browser.
                      err = re.sub('(?:<.*?>)', '', err[0])
                      if err:
                          raise LogbookMessageRejected('Rejected because of: ' + err)
                      else:
                          raise LogbookMessageRejected('Rejected because of unknown error.')
      
                  # Other unknown errors
                  raise LogbookMessageRejected('Rejected because of unknown error.')
              else:
                  location = response.headers.get('Location')
                  if location is not None:
                      if 'has moved' in location:
                          raise LogbookServerProblem('Logbook server has moved to another location.')
                      elif 'fail' in location:
                          raise LogbookAuthenticationError('Invalid username or password.')
                      else:
                          # returned locations is something like: '<host>/<sub_dir>/<logbook>/<msg_id><query>
                          # with urllib.parse.urlparse returns attribute path=<sub_dir>/<logbook>/<msg_id>
                          try:
                              msg_id = int(urllib.parse.urlsplit(location).path.split('/')[-1])
                          except ValueError as e:
                              # it was not possible to get the msg_id.
                              # this may happen when deleting the last entry of a logbook
                              msg_id = None
      
                  if b'type=password' in response.content or b'type="password"' in response.content:
                      # Not too smart to check this way, but no other indication of this kind of error.
                      # C client does it the same way
      >               raise LogbookAuthenticationError('Invalid username or password.')
      E               slic.utils.logbook_exceptions.LogbookAuthenticationError: Invalid username or password.
      
      slic/utils/logbook.py:838: LogbookAuthenticationError
      

      📌 Teardown phase

      duration:

      0.00023472821339964867
      

      outcome:

      passed
      

    Function: test_get_default_elog_instance_asks_password_and_opens

    • Test 3

      📌 Setup phase

      duration:

      0.00013473443686962128
      

      outcome:

      passed
      

      📌 Call phase

      duration:

      0.012757003773003817
      

      outcome:

      failed
      

      crash:

      path: /workspace/tligui_y/slic/tests/test_utils_elog.py
      lineno: 68
      message: Failed: elog.open() raised an unexpected exception: Invalid username or password.
      

      traceback:

      -   path: tests/test_utils_elog.py
        lineno: 68
        message: Failed
      

      longrepr:

      mock_home = <MagicMock name='home' id='140183894300608'>
      mock_getpass = <MagicMock name='getpass' id='140183896177008'>
      
          @patch("slic.utils.elog.getpass")
          @patch("slic.utils.elog.Path.home")
          def test_get_default_elog_instance_asks_password_and_opens(mock_home, mock_getpass):
              mock_home.return_value = Path("/does/not/exist")  # Fausse home → lecture échoue
              mock_getpass.return_value = "testpassword"
              user = "robot"
              text = "This is a message2"
              url = "http://localhost:8080/demo"
      
              elog = Elog("http://localhost:8080/demo", user=user)
      
              try:
      >           elog.post(text)
      
      tests/test_utils_elog.py:66: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      slic/utils/elog.py:17: in post
          return self._log.post(*args, **kwargs)
      slic/utils/logbook.py:273: in post
          resp_message, resp_headers, resp_msg_id = _validate_response(response)
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      
      response = <Response [200]>
      
          def _validate_response(response):
              """ Validate response of the request."""
      
              msg_id = None
      
              if response.status_code not in [200, 302]:
                  # 200 --> OK; 302 --> Found
                  # Html page is returned with error description (handling errors same way as on original client. Looks
                  # like there is no other way.
      
                  err = re.findall('<td.*?class="errormsg".*?>.*?</td>',
                                   response.content.decode('utf-8', 'ignore'),
                                   flags=re.DOTALL)
      
                  if len(err) > 0:
                      # Remove html tags
                      # If part of the message has: Please go  back... remove this part since it is an instruction for
                      # the user when using browser.
                      err = re.sub('(?:<.*?>)', '', err[0])
                      if err:
                          raise LogbookMessageRejected('Rejected because of: ' + err)
                      else:
                          raise LogbookMessageRejected('Rejected because of unknown error.')
      
                  # Other unknown errors
                  raise LogbookMessageRejected('Rejected because of unknown error.')
              else:
                  location = response.headers.get('Location')
                  if location is not None:
                      if 'has moved' in location:
                          raise LogbookServerProblem('Logbook server has moved to another location.')
                      elif 'fail' in location:
                          raise LogbookAuthenticationError('Invalid username or password.')
                      else:
                          # returned locations is something like: '<host>/<sub_dir>/<logbook>/<msg_id><query>
                          # with urllib.parse.urlparse returns attribute path=<sub_dir>/<logbook>/<msg_id>
                          try:
                              msg_id = int(urllib.parse.urlsplit(location).path.split('/')[-1])
                          except ValueError as e:
                              # it was not possible to get the msg_id.
                              # this may happen when deleting the last entry of a logbook
                              msg_id = None
      
                  if b'type=password' in response.content or b'type="password"' in response.content:
                      # Not too smart to check this way, but no other indication of this kind of error.
                      # C client does it the same way
      >               raise LogbookAuthenticationError('Invalid username or password.')
      E               slic.utils.logbook_exceptions.LogbookAuthenticationError: Invalid username or password.
      
      slic/utils/logbook.py:838: LogbookAuthenticationError
      
      During handling of the above exception, another exception occurred:
      
      mock_home = <MagicMock name='home' id='140183894300608'>
      mock_getpass = <MagicMock name='getpass' id='140183896177008'>
      
          @patch("slic.utils.elog.getpass")
          @patch("slic.utils.elog.Path.home")
          def test_get_default_elog_instance_asks_password_and_opens(mock_home, mock_getpass):
              mock_home.return_value = Path("/does/not/exist")  # Fausse home → lecture échoue
              mock_getpass.return_value = "testpassword"
              user = "robot"
              text = "This is a message2"
              url = "http://localhost:8080/demo"
      
              elog = Elog("http://localhost:8080/demo", user=user)
      
              try:
                  elog.post(text)
              except Exception as e:
      >           pytest.fail(f"elog.open() raised an unexpected exception: {e}")
      E           Failed: elog.open() raised an unexpected exception: Invalid username or password.
      
      tests/test_utils_elog.py:68: Failed
      

      📌 Teardown phase

      duration:

      0.0002209749072790146
      

      outcome:

      passed
      

    Function: test_get_default_elog_with_path_home

    • Test 4

      📌 Setup phase

      duration:

      0.00013629719614982605
      

      outcome:

      passed
      

      📌 Call phase

      duration:

      0.008140441961586475
      

      outcome:

      failed
      

      crash:

      path: /workspace/tligui_y/slic/tests/test_utils_elog.py
      lineno: 102
      message: Failed: elog.open() raised an unexpected exception: Invalid username or password.
      

      traceback:

      -   path: tests/test_utils_elog.py
        lineno: 102
        message: Failed
      

      longrepr:

      mock_home = <MagicMock name='home' id='140183894394528'>
      mock_getuser = <MagicMock name='getuser' id='140183894370096'>
      mock_getpass = <MagicMock name='getpass' id='140183896128624'>
      
          @patch("slic.utils.elog.getpass")
          @patch("slic.utils.elog.getuser")
          @patch("slic.utils.elog.Path.home")
          def test_get_default_elog_with_path_home(mock_home, mock_getuser, mock_getpass):
              fake_user = "robot"
              fake_pw = "testpassword"
              mock_getuser.return_value = fake_user
              mock_getpass.return_value = fake_pw  # fallback safety
              text = "This is a message3"
              url = "http://localhost:8080/demo"
      
              tmp_home = Path("/tmp/fake_home_for_robot")
              tmp_home.mkdir(parents=True, exist_ok=True)
              pw_file = tmp_home / ".elog_psi"
              pw_file.write_text(fake_pw)
              mock_home.return_value = tmp_home
      
              try:
                  elog = Elog("http://localhost:8080/demo")
                  try:
      >               elog.post(text)
      
      tests/test_utils_elog.py:100: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      slic/utils/elog.py:17: in post
          return self._log.post(*args, **kwargs)
      slic/utils/logbook.py:273: in post
          resp_message, resp_headers, resp_msg_id = _validate_response(response)
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      
      response = <Response [200]>
      
          def _validate_response(response):
              """ Validate response of the request."""
      
              msg_id = None
      
              if response.status_code not in [200, 302]:
                  # 200 --> OK; 302 --> Found
                  # Html page is returned with error description (handling errors same way as on original client. Looks
                  # like there is no other way.
      
                  err = re.findall('<td.*?class="errormsg".*?>.*?</td>',
                                   response.content.decode('utf-8', 'ignore'),
                                   flags=re.DOTALL)
      
                  if len(err) > 0:
                      # Remove html tags
                      # If part of the message has: Please go  back... remove this part since it is an instruction for
                      # the user when using browser.
                      err = re.sub('(?:<.*?>)', '', err[0])
                      if err:
                          raise LogbookMessageRejected('Rejected because of: ' + err)
                      else:
                          raise LogbookMessageRejected('Rejected because of unknown error.')
      
                  # Other unknown errors
                  raise LogbookMessageRejected('Rejected because of unknown error.')
              else:
                  location = response.headers.get('Location')
                  if location is not None:
                      if 'has moved' in location:
                          raise LogbookServerProblem('Logbook server has moved to another location.')
                      elif 'fail' in location:
                          raise LogbookAuthenticationError('Invalid username or password.')
                      else:
                          # returned locations is something like: '<host>/<sub_dir>/<logbook>/<msg_id><query>
                          # with urllib.parse.urlparse returns attribute path=<sub_dir>/<logbook>/<msg_id>
                          try:
                              msg_id = int(urllib.parse.urlsplit(location).path.split('/')[-1])
                          except ValueError as e:
                              # it was not possible to get the msg_id.
                              # this may happen when deleting the last entry of a logbook
                              msg_id = None
      
                  if b'type=password' in response.content or b'type="password"' in response.content:
                      # Not too smart to check this way, but no other indication of this kind of error.
                      # C client does it the same way
      >               raise LogbookAuthenticationError('Invalid username or password.')
      E               slic.utils.logbook_exceptions.LogbookAuthenticationError: Invalid username or password.
      
      slic/utils/logbook.py:838: LogbookAuthenticationError
      
      During handling of the above exception, another exception occurred:
      
      mock_home = <MagicMock name='home' id='140183894394528'>
      mock_getuser = <MagicMock name='getuser' id='140183894370096'>
      mock_getpass = <MagicMock name='getpass' id='140183896128624'>
      
          @patch("slic.utils.elog.getpass")
          @patch("slic.utils.elog.getuser")
          @patch("slic.utils.elog.Path.home")
          def test_get_default_elog_with_path_home(mock_home, mock_getuser, mock_getpass):
              fake_user = "robot"
              fake_pw = "testpassword"
              mock_getuser.return_value = fake_user
              mock_getpass.return_value = fake_pw  # fallback safety
              text = "This is a message3"
              url = "http://localhost:8080/demo"
      
              tmp_home = Path("/tmp/fake_home_for_robot")
              tmp_home.mkdir(parents=True, exist_ok=True)
              pw_file = tmp_home / ".elog_psi"
              pw_file.write_text(fake_pw)
              mock_home.return_value = tmp_home
      
              try:
                  elog = Elog("http://localhost:8080/demo")
                  try:
                      elog.post(text)
                  except Exception as e:
      >               pytest.fail(f"elog.open() raised an unexpected exception: {e}")
      E               Failed: elog.open() raised an unexpected exception: Invalid username or password.
      
      tests/test_utils_elog.py:102: Failed
      

      📌 Teardown phase

      duration:

      0.0002342252992093563
      

      outcome:

      passed
      

    Function: test_screenshot

    • Test 5

      📌 Setup phase

      duration:

      0.00013813981786370277
      

      outcome:

      passed
      

      📌 Call phase

      duration:

      0.007770276162773371
      

      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_124922_fake_screenshot.png"
      

      traceback:

      -   path: tests/test_utils_elog.py
        lineno: 141
        message: None
      -   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='140183894400832'>
      
          @patch("slic.utils.elog.Screenshot")
          def test_screenshot(mock_screenshot_class):
              fake_path = "/tmp/fake_screenshot.png"
              with open(fake_path, "wb") as f:
                  f.write(b"fake image data")
      
              mock_instance = mock_screenshot_class.return_value
              mock_instance.shoot.return_value = [fake_path]
      
              elog = elog = Elog("http://localhost:8080/demo", user="robot", password="testpassword")
      
              test_msg = "SCREENSHOT_INTEGRATION_TEST_MSG_456"
      >       elog.screenshot(message=test_msg)
      
      tests/test_utils_elog.py:141: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      slic/utils/elog.py:22: in screenshot
          self.post(message, **kwargs)
      slic/utils/elog.py:17: in post
          return self._log.post(*args, **kwargs)
      slic/utils/logbook.py:273: in post
          resp_message, resp_headers, resp_msg_id = _validate_response(response)
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      
      response = <Response [404]>
      
          def _validate_response(response):
              """ Validate response of the request."""
      
              msg_id = None
      
              if response.status_code not in [200, 302]:
                  # 200 --> OK; 302 --> Found
                  # Html page is returned with error description (handling errors same way as on original client. Looks
                  # like there is no other way.
      
                  err = re.findall('<td.*?class="errormsg".*?>.*?</td>',
                                   response.content.decode('utf-8', 'ignore'),
                                   flags=re.DOTALL)
      
                  if len(err) > 0:
                      # Remove html tags
                      # If part of the message has: Please go  back... remove this part since it is an instruction for
                      # the user when using browser.
                      err = re.sub('(?:<.*?>)', '', err[0])
                      if err:
      >                   raise LogbookMessageRejected('Rejected because of: ' + err)
      E                   slic.utils.logbook_exceptions.LogbookMessageRejected: Rejected because of: Cannot write attachment file "/root/elog_instance/logbooks/demo/2025/250814_124922_fake_screenshot.png"
      
      slic/utils/logbook.py:812: LogbookMessageRejected
      

      📌 Teardown phase

      duration:

      0.00020927703008055687
      

      outcome:

      passed
      

📚 Collected files

(1 tests)
    • Outcome: passed
    • result:
    -   nodeid: tests/test_utils_elog.py
      type: Module
    
tests (1 tests)
  • 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: 53
    -   nodeid: tests/test_utils_elog.py::test_get_default_elog_with_path_home
      type: Function
      lineno: 79
    -   nodeid: tests/test_utils_elog.py::test_screenshot
      type: Function
      lineno: 128
    

⚠️ Warnings

Warnings nº1
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
Warnings nº2
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