Clone
1
run 2201 TEST commit a16c49f
ci-bot edited this page 2025-08-14 08:08:24 +00:00

Test Report

View CI Run 2201 | Commit a16c49f

🧪 Test Report

Generated on 2025-08-14 10:08:01 CEST

🧾 General Info

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

📋 Summary

  • Failed: 5
  • Passed: 1
  • Total: 6
  • Collected: 6

🔎 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.0004052831791341305
      

      outcome:

      passed
      

      📌 Call phase

      duration:

      0.0064878747798502445
      

      outcome:

      failed
      

      crash:

      path: /workspace/tligui_y/slic/tests/test_utils_elog.py
      lineno: 47
      message: AttributeError: 'Logbook' object has no attribute 'status_code'
      

      traceback:

      -   path: tests/test_utils_elog.py
        lineno: 47
        message: AttributeError
      

      longrepr:

      def test_get_default_elog_instance_with_direct_password_and_real_check():
              url = "http://localhost:8080/demo"
              user = "robot"
              password = "testpassword"
      
              elog_instance, returned_user = get_default_elog_instance(url, user=user, password=password)
      
              assert returned_user == user
              assert hasattr(elog_instance, "post")
      
              pw = get_default_elog_password(url, user=user, password=password)
      
              r = elog.open(url, user=user, password=pw)
      >       assert r.status_code == 200
      E       AttributeError: 'Logbook' object has no attribute 'status_code'
      
      tests/test_utils_elog.py:47: AttributeError
      

      📌 Teardown phase

      duration:

      0.0003964467905461788
      

      outcome:

      passed
      

    Function: test_get_default_elog_instance_asks_password_and_opens

    • Test 2

      📌 Setup phase

      duration:

      0.00015420978888869286
      

      outcome:

      passed
      

      📌 Call phase

      duration:

      0.0045443009585142136
      

      outcome:

      failed
      

      crash:

      path: /workspace/tligui_y/slic/.pixi/envs/default/lib/python3.8/getpass.py
      lineno: 148
      message: EOFError
      

      traceback:

      -   path: tests/test_utils_elog.py
        lineno: 63
        message: None
      -   path: tests/test_utils_elog.py
        lineno: 27
        message: in get_default_elog_password
      -   path: .pixi/envs/default/lib/python3.8/getpass.py
        lineno: 91
        message: in unix_getpass
      -   path: .pixi/envs/default/lib/python3.8/getpass.py
        lineno: 126
        message: in fallback_getpass
      -   path: .pixi/envs/default/lib/python3.8/getpass.py
        lineno: 148
        message: EOFError
      

      longrepr:

      url = 'http://localhost:8080/demo', kwargs = {'user': 'robot'}, user = 'robot'
      home = PosixPath('/does/not/exist'), fn = PosixPath('/does/not/exist/.elog_psi')
      
          def get_default_elog_password(url, **kwargs):
              kwargs.setdefault("user", getuser())
              user = kwargs["user"]
      
              if "password" not in kwargs:
                  try:
                      home = Path.home()
                      fn = home / ".elog_psi"
      >               with fn.open() as f:
      
      tests/test_utils_elog.py:23: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      .pixi/envs/default/lib/python3.8/pathlib.py:1222: in open
          return io.open(self, mode, buffering, encoding, errors, newline,
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      
      self = PosixPath('/does/not/exist/.elog_psi')
      name = '/does/not/exist/.elog_psi', flags = 524288, mode = 438
      
          def _opener(self, name, flags, mode=0o666):
              # A stub for the opener argument to built-in open()
      >       return self._accessor.open(self, flags, mode)
      E       FileNotFoundError: [Errno 2] No such file or directory: '/does/not/exist/.elog_psi'
      
      .pixi/envs/default/lib/python3.8/pathlib.py:1078: FileNotFoundError
      
      During handling of the above exception, another exception occurred:
      
      prompt = 'Password: '
      stream = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>
      
          def unix_getpass(prompt='Password: ', stream=None):
              """Prompt for a password, with echo turned off.
      
              Args:
                prompt: Written on stream to ask for the input.  Default: 'Password: '
                stream: A writable file object to display the prompt.  Defaults to
                        the tty.  If no tty is available defaults to sys.stderr.
              Returns:
                The seKr3t input.
              Raises:
                EOFError: If our input tty or stdin was closed.
                GetPassWarning: When we were unable to turn echo off on the input.
      
              Always restores terminal settings before returning.
              """
              passwd = None
              with contextlib.ExitStack() as stack:
                  try:
                      # Always try reading and writing directly on the tty first.
                      fd = os.open('/dev/tty', os.O_RDWR|os.O_NOCTTY)
                      tty = io.FileIO(fd, 'w+')
                      stack.enter_context(tty)
                      input = io.TextIOWrapper(tty)
                      stack.enter_context(input)
                      if not stream:
                          stream = input
                  except OSError as e:
                      # If that fails, see if stdin can be controlled.
                      stack.close()
                      try:
                          fd = sys.stdin.fileno()
                      except (AttributeError, ValueError):
                          fd = None
                          passwd = fallback_getpass(prompt, stream)
                      input = sys.stdin
                      if not stream:
                          stream = sys.stderr
      
                  if fd is not None:
                      try:
      >                   old = termios.tcgetattr(fd)     # a copy to save
      E                   termios.error: (25, 'Inappropriate ioctl for device')
      
      .pixi/envs/default/lib/python3.8/getpass.py:69: error
      
      During handling of the above exception, another exception occurred:
      
      mock_home = <MagicMock name='home' id='140024009313920'>
      mock_getpass = <MagicMock name='getpass' id='140024014104416'>
      
          @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"
      
              url = "http://localhost:8080/demo"
              user = "robot"
      
              elog_instance, returned_user = get_default_elog_instance(url, user=user)
      
              assert returned_user == user
              assert hasattr(elog_instance, "post")
      
      >       pw = get_default_elog_password(url, user=user)
      
      tests/test_utils_elog.py:63: 
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      tests/test_utils_elog.py:27: in get_default_elog_password
          pw = getpass()
      .pixi/envs/default/lib/python3.8/getpass.py:91: in unix_getpass
          passwd = fallback_getpass(prompt, stream)
      .pixi/envs/default/lib/python3.8/getpass.py:126: in fallback_getpass
          return _raw_input(prompt, stream)
      _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      
      prompt = 'Password: '
      stream = <_io.TextIOWrapper name='<stderr>' mode='w' encoding='utf-8'>
      input = <_io.TextIOWrapper name='<stdin>' mode='r' encoding='utf-8'>
      
          def _raw_input(prompt="", stream=None, input=None):
              # This doesn't save the string in the GNU readline history.
              if not stream:
                  stream = sys.stderr
              if not input:
                  input = sys.stdin
              prompt = str(prompt)
              if prompt:
                  try:
                      stream.write(prompt)
                  except UnicodeEncodeError:
                      # Use replace error handler to get as much as possible printed.
                      prompt = prompt.encode(stream.encoding, 'replace')
                      prompt = prompt.decode(stream.encoding)
                      stream.write(prompt)
                  stream.flush()
              # NOTE: The Python C API calls flockfile() (and unlock) during readline.
              line = input.readline()
              if not line:
      >           raise EOFError
      E           EOFError
      
      .pixi/envs/default/lib/python3.8/getpass.py:148: EOFError
      

      📌 Teardown phase

      duration:

      0.00025508878752589226
      

      outcome:

      passed
      

    Function: test_get_default_elog_with_path_home

    • Test 3

      📌 Setup phase

      duration:

      0.00014784792438149452
      

      outcome:

      passed
      

      📌 Call phase

      duration:

      0.010343742091208696
      

      outcome:

      failed
      

      crash:

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

      traceback:

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

      longrepr:

      mock_home = <MagicMock name='home' id='140024007731040'>
      mock_getuser = <MagicMock name='getuser' id='140024009581136'>
      mock_getpass = <MagicMock name='getpass' id='140024009515936'>
      
          @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
      
              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
      
              url = "http://localhost:8080/demo"
      
              try:
                  elog_instance, returned_user = get_default_elog_instance(url)
      
                  assert returned_user == fake_user
                  assert hasattr(elog_instance, "post")
      
                  pw = get_default_elog_password(url)
      
      >           r = elog.open(url, user=user, password=pw)
      E           NameError: name 'user' is not defined
      
      tests/test_utils_elog.py:94: NameError
      

      📌 Teardown phase

      duration:

      0.00020965980365872383
      

      outcome:

      passed
      

    Function: test_get_default_elog_instance_with_wrong_password

    • Test 4

      📌 Setup phase

      duration:

      0.000138851348310709
      

      outcome:

      passed
      

      📌 Call phase

      duration:

      0.0034871650859713554
      

      outcome:

      failed
      

      crash:

      path: /workspace/tligui_y/slic/tests/test_utils_elog.py
      lineno: 107
      message: Failed: DID NOT RAISE <class 'requests.exceptions.HTTPError'>
      

      traceback:

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

      longrepr:

      def test_get_default_elog_instance_with_wrong_password():
              url = "http://localhost:8080/demo"
              user = "robot"
              wrong_password = "wrongpassword"
      
              with pytest.raises(requests.exceptions.HTTPError):
      >           get_default_elog_instance(url, user=user, password=wrong_password)
      E           Failed: DID NOT RAISE <class 'requests.exceptions.HTTPError'>
      
      tests/test_utils_elog.py:107: Failed
      

      📌 Teardown phase

      duration:

      0.00015613622963428497
      

      outcome:

      passed
      

    Function: test_screenshot

    • Test 6

      📌 Setup phase

      duration:

      0.00013636332005262375
      

      outcome:

      passed
      

      📌 Call phase

      duration:

      0.036423813086003065
      

      outcome:

      failed
      

      crash:

      path: /workspace/tligui_y/slic/tests/test_utils_elog.py
      lineno: 161
      message: AssertionError: Attachment 'tmpa7eg_ytu.png' not found in post HTML
      assert 'tmpa7eg_ytu.png' in '\n\n\nELOG demo\n\n\n\n\n\n\n\n\n\ndemo\n\n\n\xa0\xa0demo, Page 1 of 1\xa0\n\n\n\n\xa0New\xa0|\n\xa0Find\xa0|\n\xa0Se...02\xa0\xa0\n\nThu Aug 14 08:07:58 2025\nrobot\xa0\xa0\xa0SCREENSHOT_INTEGRATION_TEST_MSG_456\n\n\n\nELOG V2.7.1-2004\n'
      

      traceback:

      -   path: tests/test_utils_elog.py
        lineno: 161
        message: AssertionError
      

      longrepr:

      mock_screenshot_class = <MagicMock name='Screenshot' id='140024009662960'>
      
          @patch("slic.utils.elog.Screenshot")
          def test_screenshot(mock_screenshot_class):
              with tempfile.NamedTemporaryFile(delete=False, suffix=".png") as tmp:
                  fake_path = tmp.name
                  tmp.write(b"fake image data")
      
              mock_instance = mock_screenshot_class.return_value
              mock_instance.shoot.return_value = [fake_path]
      
              elog = get_test_elog()
      
              test_msg = "SCREENSHOT_INTEGRATION_TEST_MSG_456"
              elog.screenshot(message=test_msg)
      
              url = "http://localhost:8080/demo"
              response = requests.get(url)
      
              print("Texte bruuuut :", response.content)
      
      
              soup = BeautifulSoup(response.content, 'html.parser')
              content = soup.get_text()
      
              print("Texte brut :", content)
      
              filename = os.path.basename(fake_path)
      
              assert test_msg in content, "Message not found"
      >       assert filename in content, f"Attachment '{filename}' not found in post HTML"
      E       AssertionError: Attachment 'tmpa7eg_ytu.png' not found in post HTML
      E       assert 'tmpa7eg_ytu.png' in '\n\n\nELOG demo\n\n\n\n\n\n\n\n\n\ndemo\n\n\n\xa0\xa0demo, Page 1 of 1\xa0\n\n\n\n\xa0New\xa0|\n\xa0Find\xa0|\n\xa0Se...02\xa0\xa0\n\nThu Aug 14 08:07:58 2025\nrobot\xa0\xa0\xa0SCREENSHOT_INTEGRATION_TEST_MSG_456\n\n\n\nELOG V2.7.1-2004\n'
      
      tests/test_utils_elog.py:161: AssertionError
      

      📌 Teardown phase

      duration:

      0.00023583602160215378
      

      outcome:

      passed
      
Passed (1)
  • 📄 test_utils_elog.py

    Function: test_post

    • Test 5

      📌 Setup phase

      duration:

      0.00012817978858947754
      

      outcome:

      passed
      

      📌 Call phase

      duration:

      0.047760373912751675
      

      outcome:

      passed
      

      📌 Teardown phase

      duration:

      0.00019752420485019684
      

      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: 33
    -   nodeid: tests/test_utils_elog.py::test_get_default_elog_instance_asks_password_and_opens
      type: Function
      lineno: 48
    -   nodeid: tests/test_utils_elog.py::test_get_default_elog_with_path_home
      type: Function
      lineno: 68
    -   nodeid: tests/test_utils_elog.py::test_get_default_elog_instance_with_wrong_password
      type: Function
      lineno: 100
    -   nodeid: tests/test_utils_elog.py::test_post
      type: Function
      lineno: 109
    -   nodeid: tests/test_utils_elog.py::test_screenshot
      type: Function
      lineno: 132
    

⚠️ 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
Warnings nº3
message: Can not control echo on the terminal.
category: GetPassWarning
when: runtest
filename: /workspace/tligui_y/slic/.pixi/envs/default/lib/python3.8/getpass.py
lineno: 91