Uploaded image for project: 'Picard'
  1. Picard
  2. PICARD-1561

test_file.TestPreserveTimes fails on macOS 10.14

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Normal Normal
    • 2.2
    • None
    • None
    • None
    • macOS 10.14

      On macOS 10.14 the test_file.TestPreserveTimes test fails. See Travis on https://travis-ci.org/metabrainz/picard/jobs/561989031 , but I can also reproduce this locally.

      Some further testing shows that os.utime even with the ns parameter only sets to full seconds on macOS 10.14. It works on earlier versions.

      Right now I can't say whether this is a Python or OS limitation.

      @zas: Do you think we really need the millisecond precision here? Do you think it would be sufficient to alter the test to check only for full seconds (we could still keep setting milliseconds in place).

       

      =================================== FAILURES ===================================
      ____________________ TestPreserveTimes.test_preserve_times _____________________
      self = <test.test_file.TestPreserveTimes testMethod=test_preserve_times>
      def test_preserve_times(self):
      self._create_testfile()

      1. test if times are preserved
        (before_atime_ns, before_mtime_ns) = self.file._preserve_times(self.file.filename, self._modify_testfile)
      1. HERE an external access to the file is possible, modifying its access time
      1. read times again and compare with original
        st = os.stat(self.file.filename)
        (after_atimes_ns, after_mtimes_ns) = (st.st_atime_ns, st.st_mtime_ns)
      1. modification times should be equal
        > self.assertEqual(before_mtime_ns, after_mtimes_ns)
        E AssertionError: 1563786391262226468 != 1563786391262226000
        test/test_file.py:77: AssertionError

            outsidecontext Philipp Wolfer
            outsidecontext Philipp Wolfer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Version Package
                2.2