Uploaded image for project: 'Nuxeo Drive '
  1. Nuxeo Drive
  2. NXDRIVE-2106

Bypass the rm_rf pytest warning on Windows

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.4.1
    • Fix Version/s: 4.4.2
    • Component/s: Tests
    • Environment:
      Windows

      Description

      This new warning came up with pytest 5.4.1 and made some tests fail on Windows:

      recwarn = WarningsRecorder(record=True)
      
          @pytest.fixture(autouse=True)
          def no_warnings(recwarn):
              """Fail on warning."""
          
              yield
          
              warnings = []
              for warning in recwarn:  # pragma: no cover
                  message = str(warning.message)
          
                  if "sentry_sdk" in warning.filename:
                      continue
                  elif "WaitForInputIdle" in message:
                      # Happen while testing the integration on Windows, we can skip it:
                      # "Application is not loaded correctly (WaitForInputIdle failed)"
                      continue
                  elif "type=SocketKind.SOCK_STREAM" in message:
                      # Socket leaks on macOS, may need investigations
                      continue
                  elif "TerminalReporter.writer attribute is deprecated" in message:
                      # Cannot understand if this is from our code or a pytest plugin,
                      # let's wait for when it will fail :)
                      continue
          
                  warn = f"{warning.filename}:{warning.lineno} {message}"
                  print(warn, file=sys.stderr)
                  warnings.append(warn)
          
      >       assert not warnings
      E       assert not ["C:\\Jenkins\\workspace\\Drive\\Drive-OS-test-jobs\\Drive-tests-windows-master\\deploy-dir\\3.7.4\\lib\\site-packages...ocal\\\\temp\\\\pytest-of-jenkins\\\\garbage-5b060f31-7022-4d82-9045-e09bbee235a3\\\\test_trash_long_file0\\\\1'", ...]
      
      message    = "(rm_rf) error removing C:\\Users\\jenkins\\AppData\\Local\\temp\\pytest-of-jenkins\\garbage-5b060f31-7022-4d82-9045-e...\\\\Users\\\\jenkins\\\\AppData\\\\Local\\\\temp\\\\pytest-of-jenkins\\\\garbage-5b060f31-7022-4d82-9045-e09bbee235a3'"
      recwarn    = WarningsRecorder(record=True)
      warn       = "C:\\Jenkins\\workspace\\Drive\\Drive-OS-test-jobs\\Drive-tests-windows-master\\deploy-dir\\3.7.4\\lib\\site-packages\...\\\\Users\\\\jenkins\\\\AppData\\\\Local\\\\temp\\\\pytest-of-jenkins\\\\garbage-5b060f31-7022-4d82-9045-e09bbee235a3'"
      warning    = <warnings.WarningMessage object at 0x03B563F0>
      warnings   = ["C:\\Jenkins\\workspace\\Drive\\Drive-OS-test-jobs\\Drive-tests-windows-master\\deploy-dir\\3.7.4\\lib\\site-packages...ocal\\\\temp\\\\pytest-of-jenkins\\\\garbage-5b060f31-7022-4d82-9045-e09bbee235a3\\\\test_trash_long_file0\\\\1'", ...]
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 15 minutes
                15m