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

Use mock'ed objects instead of manual swap

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 4.0.4
    • Fix Version/s: 4.1.0
    • Component/s: Tests

      Description

      In tests, we can see a lot of code like:

      obj2 = something()
      obj_orig = self.engine_1.remote
      self.engine_1.remote = obj2
      # ... testings
      self.engine_1.remote = obj_orig 
      

      This is error prone as sometimes we do not restore the original object.
      Also we should leverage the powerful unittest.mock.patch() function for those usages.

      It will assure us less random bugs in some places.

        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 - 1 hour
                1h