#30366: The StatReloaderTests will fail on Mac OSX when HFS+ is used as a
filesystem
-------------------------------------+-------------------------------------
               Reporter:  Martijn    |          Owner:  nobody
  Jacobs                             |
                   Type:             |         Status:  assigned
  Uncategorized                      |
              Component:  Testing    |        Version:  master
  framework                          |
               Severity:  Normal     |       Keywords:  HFS+ OSX Testing
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 HFS+ is the default filesystem for Mac OSX Sierra (10.12.x) and below
 before it was replaced with APFS in High Sierra (10.13.x) and above.

 HFS+ has the unfortunate disadvantage of having a timestamp resolution of
 1 second.

 In the {{{StatReloaderTests}}} class the reloader sleep time is set to
 0.01 seconds to speed up the tests:
 {{{#!python
 class StatReloaderTests(ReloaderTests, IntegrationTests):
     RELOADER_CLS = autoreload.StatReloader

     def setUp(self):
         super().setUp()
         # Shorten the sleep time to speed up tests.
         self.reloader.SLEEP_TIME = 0.01
 }}}

 This will result that these tests will fail when using HFS+ as a
 filesystem because it won't detect that files have been created or
 changed:

 {{{
 ======================================================================
 FAIL: test_glob_non_existing_directory
 (utils_tests.test_autoreload.StatReloaderTests)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 "/Users/martijn/.pyenv/versions/3.7.2/lib/python3.7/unittest/case.py",
 line 59, in testPartExecutor
     yield
   File
 "/Users/martijn/.pyenv/versions/3.7.2/lib/python3.7/unittest/case.py",
 line 615, in run
     testMethod()
   File
 "/Users/martijn/.pyenv/versions/3.7.2/lib/python3.7/unittest/mock.py",
 line 1195, in patched
     return func(*args, **keywargs)
   File
 "/Users/martijn/Dev/oss/django/tests/utils_tests/test_autoreload.py", line
 418, in test_glob_non_existing_directory
     self.assertEqual(notify_mock.call_count, 1)
   File
 "/Users/martijn/.pyenv/versions/3.7.2/lib/python3.7/unittest/case.py",
 line 839, in assertEqual
     assertion_func(first, second, msg=msg)
   File
 "/Users/martijn/.pyenv/versions/3.7.2/lib/python3.7/unittest/case.py",
 line 832, in _baseAssertEqual
     raise self.failureException(msg)
 AssertionError: 0 != 1

 ======================================================================
 FAIL: test_nonexistent_file
 (utils_tests.test_autoreload.StatReloaderTests)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 "/Users/martijn/.pyenv/versions/3.7.2/lib/python3.7/unittest/case.py",
 line 59, in testPartExecutor
     yield
   File
 "/Users/martijn/.pyenv/versions/3.7.2/lib/python3.7/unittest/case.py",
 line 615, in run
     testMethod()
   File
 "/Users/martijn/.pyenv/versions/3.7.2/lib/python3.7/unittest/mock.py",
 line 1195, in patched
     return func(*args, **keywargs)
   File
 "/Users/martijn/Dev/oss/django/tests/utils_tests/test_autoreload.py", line
 384, in test_nonexistent_file
     self.assertEqual(notify_mock.call_count, 1)
   File
 "/Users/martijn/.pyenv/versions/3.7.2/lib/python3.7/unittest/case.py",
 line 839, in assertEqual
     assertion_func(first, second, msg=msg)
   File
 "/Users/martijn/.pyenv/versions/3.7.2/lib/python3.7/unittest/case.py",
 line 832, in _baseAssertEqual
     raise self.failureException(msg)
 AssertionError: 0 != 1

 ======================================================================
 FAIL: test_nonexistent_file_in_non_existing_directory
 (utils_tests.test_autoreload.StatReloaderTests)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 "/Users/martijn/.pyenv/versions/3.7.2/lib/python3.7/unittest/case.py",
 line 59, in testPartExecutor
     yield
   File
 "/Users/martijn/.pyenv/versions/3.7.2/lib/python3.7/unittest/case.py",
 line 615, in run
     testMethod()
   File
 "/Users/martijn/.pyenv/versions/3.7.2/lib/python3.7/unittest/mock.py",
 line 1195, in patched
     return func(*args, **keywargs)
   File
 "/Users/martijn/Dev/oss/django/tests/utils_tests/test_autoreload.py", line
 395, in test_nonexistent_file_in_non_existing_directory
     self.assertEqual(notify_mock.call_count, 1)
   File
 "/Users/martijn/.pyenv/versions/3.7.2/lib/python3.7/unittest/case.py",
 line 839, in assertEqual
     assertion_func(first, second, msg=msg)
   File
 "/Users/martijn/.pyenv/versions/3.7.2/lib/python3.7/unittest/case.py",
 line 832, in _baseAssertEqual
     raise self.failureException(msg)
 AssertionError: 0 != 1

 ----------------------------------------------------------------------
 }}}


 How to reproduce:
 {{{
 ./runtests.py utils_tests.test_autoreload
 }}}

 on a Mac OSX computer which (still) uses HFS+

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30366>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.8eeb929ff0ce71801b1f4706033017ae%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to