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.
This commit is contained in:
parent
8b3f1c35dd
commit
9141da1a80
|
@ -11,7 +11,7 @@ import weakref
|
|||
import zipfile
|
||||
from importlib import import_module
|
||||
from pathlib import Path
|
||||
from unittest import mock, skip
|
||||
from unittest import mock, skip, skipIf
|
||||
|
||||
from django.apps.registry import Apps
|
||||
from django.test import SimpleTestCase
|
||||
|
@ -19,6 +19,8 @@ from django.test.utils import extend_sys_path
|
|||
from django.utils import autoreload
|
||||
from django.utils.autoreload import WatchmanUnavailable
|
||||
|
||||
from .utils import on_macos_with_hfs
|
||||
|
||||
|
||||
class TestIterModulesAndFiles(SimpleTestCase):
|
||||
def import_and_cleanup(self, name):
|
||||
|
@ -637,6 +639,7 @@ class WatchmanReloaderTests(ReloaderTests, IntegrationTests):
|
|||
self.assertIsInstance(mocked_server_status.call_args[0][0], TestException)
|
||||
|
||||
|
||||
@skipIf(on_macos_with_hfs(), "These tests do not work with HFS+ as a filesystem")
|
||||
class StatReloaderTests(ReloaderTests, IntegrationTests):
|
||||
RELOADER_CLS = autoreload.StatReloader
|
||||
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
import platform
|
||||
|
||||
|
||||
def on_macos_with_hfs():
|
||||
"""
|
||||
MacOS 10.13 (High Sierra) and lower can use HFS+ as a filesystem.
|
||||
HFS+ has a time resolution of only one second which can be too low for
|
||||
some of the tests.
|
||||
"""
|
||||
macos_version = platform.mac_ver()[0]
|
||||
if macos_version != '':
|
||||
parsed_macos_version = tuple(int(x) for x in macos_version.split('.'))
|
||||
return parsed_macos_version < (10, 14)
|
||||
return False
|
Loading…
Reference in New Issue