[Django] #30366: The StatReloaderTests will fail on Mac OSX when HFS+ is used as a filesystem

6 views
Skip to first unread message

Django

unread,
Apr 14, 2019, 8:25:06 AM4/14/19
to django-...@googlegroups.com
#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.

Django

unread,
Apr 14, 2019, 8:26:43 AM4/14/19
to django-...@googlegroups.com
#30366: The StatReloaderTests will fail on Mac OSX when HFS+ is used as a
filesystem
-------------------------------------+-------------------------------------
Reporter: Martijn Jacobs | Owner: Martijn
| Jacobs
Type: Uncategorized | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:

Keywords: HFS+ OSX Testing | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Martijn Jacobs):

* cc: Martijn Jacobs (added)
* owner: nobody => Martijn Jacobs


--
Ticket URL: <https://code.djangoproject.com/ticket/30366#comment:1>

Django

unread,
Apr 14, 2019, 8:53:27 AM4/14/19
to django-...@googlegroups.com
#30366: The StatReloaderTests will fail on Mac OSX when HFS+ is used as a
filesystem
-------------------------------------+-------------------------------------
Reporter: Martijn Jacobs | Owner: Martijn
| Jacobs
Type: Uncategorized | Status: assigned
Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: HFS+ OSX Testing | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Martijn Jacobs):

* has_patch: 0 => 1


Comment:

A possible solution can be found in the pull request here:
https://github.com/django/django/pull/11228

--
Ticket URL: <https://code.djangoproject.com/ticket/30366#comment:2>

Django

unread,
Apr 24, 2019, 6:10:00 AM4/24/19
to django-...@googlegroups.com
#30366: The StatReloaderTests will fail on Mac OSX when HFS+ is used as a
filesystem
-------------------------------------+-------------------------------------
Reporter: Martijn Jacobs | Owner: Martijn
| Jacobs
Type: Bug | Status: assigned

Component: Testing framework | Version: master
Severity: Normal | Resolution:
Keywords: HFS+ OSX Testing | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* type: Uncategorized => Bug
* stage: Unreviewed => Ready for checkin


Comment:

After discussion on the PR, we'll got for skipping the few tests on
earlier versions of macOS. Ready to go I think.

--
Ticket URL: <https://code.djangoproject.com/ticket/30366#comment:3>

Django

unread,
Apr 24, 2019, 9:29:00 AM4/24/19
to django-...@googlegroups.com
#30366: The StatReloaderTests will fail on Mac OSX when HFS+ is used as a
filesystem
-------------------------------------+-------------------------------------
Reporter: Martijn Jacobs | Owner: Martijn
| Jacobs
Type: Bug | Status: closed

Component: Testing framework | Version: master
Severity: Normal | Resolution: fixed

Keywords: HFS+ OSX Testing | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Carlton Gibson <carlton.gibson@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"9141da1a80d81b4605594af0a7930b5b011c8e29" 9141da1a]:
{{{
#!CommitTicketReference repository=""
revision="9141da1a80d81b4605594af0a7930b5b011c8e29"
Fixed #30366 -- Skipped StatReloaderTests on HFS+ filesystems.

When on MacOS High Sierra or below (<=10.13) it could be that a HFS+
filesystem is used. HFS+ has a time resolution of only one second
which can be too low for some of the tests.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30366#comment:4>

Reply all
Reply to author
Forward
0 new messages