Clone
1
run 2297 TEST commit 844e721
ci-bot edited this page 2025-08-15 14:19:53 +00:00

Test Report

View CI Run 2297 | Commit 844e721

🧪 Test Report

Generated on 2025-08-15 16:19:28 CEST

🧾 General Info

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

📋 Summary

  • Passed: 2
  • Failed: 3
  • Total: 5
  • Collected: 5

🔎 Tests

Passed (2)
  • 📄 test_utils_elog.py

    Function: test_get_default_elog_instance_with_direct_password_and_real_check

    • Test 1

      📌 Setup phase

      duration:

      0.0004252651706337929
      

      outcome:

      passed
      

      📌 Call phase

      duration:

      0.02794818300753832
      

      outcome:

      passed
      

      📌 Teardown phase

      duration:

      0.0003295326605439186
      

      outcome:

      passed
      

    Function: test_get_default_elog_instance_asks_password_and_opens

    • Test 3

      📌 Setup phase

      duration:

      0.00014708423987030983
      

      outcome:

      passed
      

      📌 Call phase

      duration:

      0.02600018261000514
      

      outcome:

      passed
      

      📌 Teardown phase

      duration:

      0.000192960724234581
      

      outcome:

      passed
      
Failed (3)
  • 📄 test_utils_elog.py

    Function: test_get_default_elog_instance_with_wrong_password_and_real_check

    • Test 2

      📌 Setup phase

      duration:

      0.0001492779701948166
      

      outcome:

      passed
      

      📌 Call phase

      duration:

      0.006722141057252884
      

      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: 40
        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: 833
        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("Should fail because wrong password")
      
      tests/test_utils_elog.py:40: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      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."""
              print("[DEBUG] _validate_response called")
              print(f"    HTTP status code : {response.status_code}")
              print(f"    Response headers : {response.headers}")
              print(f"    First 300 bytes of content:\n{response.content[:300]!r}")
      
              msg_id = None
      
              if response.status_code not in [200, 302]:
                  print("[DEBUG] Status not 200/302 → searching for <td class='errormsg'>")
                  err = re.findall('<td.*?class="errormsg".*?>.*?</td>',
                                   response.content.decode('utf-8', 'ignore'),
                                   flags=re.DOTALL)
                  if len(err) > 0:
                      err = re.sub('(?:<.*?>)', '', err[0])
                      print(f"[DEBUG] Found error message: {err}")
                      if err:
                          raise LogbookMessageRejected('Rejected because of: ' + err)
                      else:
                          raise LogbookMessageRejected('Rejected because of unknown error.')
                  raise LogbookMessageRejected('Rejected because of unknown error.')
              else:
                  location = response.headers.get('Location')
                  if location is not None:
                      print(f"[DEBUG] Location header: {location}")
                      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:
                          try:
                              msg_id = int(urllib.parse.urlsplit(location).path.split('/')[-1])
                              print(f"[DEBUG] Parsed msg_id from Location: {msg_id}")
                          except ValueError:
                              print("[DEBUG] Could not parse msg_id from Location")
                              msg_id = None
      
                  if b'type=password' in response.content or b'type="password"' in response.content:
                      print("[DEBUG] Password input detected in response HTML — assuming login page → AUTH ERROR")
      >               raise LogbookAuthenticationError('Invalid username or password.')
      E               slic.utils.logbook_exceptions.LogbookAuthenticationError: Invalid username or password.
      
      slic/utils/logbook.py:833: LogbookAuthenticationError
      

      📌 Teardown phase

      duration:

      0.00030977511778473854
      

      outcome:

      passed
      

    Function: test_get_default_elog_with_path_home

    • Test 4

      📌 Setup phase

      duration:

      0.00014149397611618042
      

      outcome:

      passed
      

      📌 Call phase

      duration:

      0.015367177315056324
      

      outcome:

      failed
      

      crash:

      path: /workspace/tligui_y/slic/tests/test_utils_elog.py
      lineno: 97
      message: NameError: name 'user' is not defined
      

      traceback:

      -   path: tests/test_utils_elog.py
        lineno: 97
        message: NameError
      

      longrepr:

      mock_home = <MagicMock name='home' id='140409582637744'>
      mock_getuser = <MagicMock name='getuser' id='140409583542128'>
      mock_getpass = <MagicMock name='getpass' id='140409583525504'>
      
          @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:
                      msg_id = elog.post(text)
                  except Exception as e:
                      pytest.fail(f"elog.open() raised an unexpected exception: {e}")
      
                  message, attributes, attachments = elog.read(msg_id)
      
                  assert text in message
      >           assert attributes.get("Author") == user
      E           NameError: name 'user' is not defined
      
      tests/test_utils_elog.py:97: NameError
      

      📌 Teardown phase

      duration:

      0.0002582320012152195
      

      outcome:

      passed
      

    Function: test_screenshot

    • Test 5

      📌 Setup phase

      duration:

      0.000149404164403677
      

      outcome:

      passed
      

      📌 Call phase

      duration:

      0.012440725229680538
      

      outcome:

      failed
      

      crash:

      path: /workspace/tligui_y/slic/slic/utils/logbook.py
      lineno: 811
      message: slic.utils.logbook_exceptions.LogbookMessageRejected: Rejected because of: Invalid URL: None
      

      traceback:

      -   path: tests/test_utils_elog.py
        lineno: 119
        message: None
      -   path: slic/utils/logbook.py
        lineno: 316
        message: in read
      -   path: slic/utils/logbook.py
        lineno: 575
        message: in _check_if_message_on_server
      -   path: slic/utils/logbook.py
        lineno: 811
        message: LogbookMessageRejected
      

      longrepr:

      mock_screenshot_class = <MagicMock name='Screenshot' id='140409583671376'>
      
          @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"
              msg_id = elog.screenshot(message=test_msg)
      
              filename = os.path.basename(fake_path)
      >       message, attributes, attachments = elog.read(msg_id)
      
      tests/test_utils_elog.py:119: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      slic/utils/logbook.py:316: in read
          self._check_if_message_on_server(msg_id)  # raises exceptions if no message or no response from server
      slic/utils/logbook.py:575: in _check_if_message_on_server
          resp_message, resp_headers, resp_msg_id = _validate_response(response)
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      
      response = <Response [404]>
      
          def _validate_response(response):
              """ Validate response of the request."""
              print("[DEBUG] _validate_response called")
              print(f"    HTTP status code : {response.status_code}")
              print(f"    Response headers : {response.headers}")
              print(f"    First 300 bytes of content:\n{response.content[:300]!r}")
      
              msg_id = None
      
              if response.status_code not in [200, 302]:
                  print("[DEBUG] Status not 200/302 → searching for <td class='errormsg'>")
                  err = re.findall('<td.*?class="errormsg".*?>.*?</td>',
                                   response.content.decode('utf-8', 'ignore'),
                                   flags=re.DOTALL)
                  if len(err) > 0:
                      err = re.sub('(?:<.*?>)', '', err[0])
                      print(f"[DEBUG] Found error message: {err}")
                      if err:
      >                   raise LogbookMessageRejected('Rejected because of: ' + err)
      E                   slic.utils.logbook_exceptions.LogbookMessageRejected: Rejected because of: Invalid URL: None
      
      slic/utils/logbook.py:811: LogbookMessageRejected
      

      📌 Teardown phase

      duration:

      0.0002933577634394169
      

      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: 31
    -   nodeid: tests/test_utils_elog.py::test_get_default_elog_instance_asks_password_and_opens
      type: Function
      lineno: 42
    -   nodeid: tests/test_utils_elog.py::test_get_default_elog_with_path_home
      type: Function
      lineno: 69
    -   nodeid: tests/test_utils_elog.py::test_screenshot
      type: Function
      lineno: 103
    

⚠️ 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