Harmonized Windows checks in tests to a single style.
This commit is contained in:
parent
e3c2fae4cd
commit
39791c8e6d
|
@ -460,7 +460,7 @@ class ListFiltersTests(TestCase):
|
||||||
self.assertEqual(choice['query_string'], '?date_registered__isnull=False')
|
self.assertEqual(choice['query_string'], '?date_registered__isnull=False')
|
||||||
|
|
||||||
@unittest.skipIf(
|
@unittest.skipIf(
|
||||||
sys.platform.startswith('win'),
|
sys.platform == 'win32',
|
||||||
"Windows doesn't support setting a timezone that differs from the "
|
"Windows doesn't support setting a timezone that differs from the "
|
||||||
"system timezone."
|
"system timezone."
|
||||||
)
|
)
|
||||||
|
|
|
@ -78,7 +78,7 @@ class ASGITest(SimpleTestCase):
|
||||||
set(response_start['headers']),
|
set(response_start['headers']),
|
||||||
{
|
{
|
||||||
(b'Content-Length', str(len(test_file_contents)).encode('ascii')),
|
(b'Content-Length', str(len(test_file_contents)).encode('ascii')),
|
||||||
(b'Content-Type', b'text/plain' if sys.platform.startswith('win') else b'text/x-python'),
|
(b'Content-Type', b'text/plain' if sys.platform == 'win32' else b'text/x-python'),
|
||||||
(b'Content-Disposition', b'inline; filename="urls.py"'),
|
(b'Content-Disposition', b'inline; filename="urls.py"'),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
|
@ -771,7 +771,7 @@ class FileFieldStorageTests(TestCase):
|
||||||
o.delete()
|
o.delete()
|
||||||
|
|
||||||
@unittest.skipIf(
|
@unittest.skipIf(
|
||||||
sys.platform.startswith('win'),
|
sys.platform == 'win32',
|
||||||
"Windows supports at most 260 characters in a path.",
|
"Windows supports at most 260 characters in a path.",
|
||||||
)
|
)
|
||||||
def test_extended_length_storage(self):
|
def test_extended_length_storage(self):
|
||||||
|
@ -897,7 +897,7 @@ class FileSaveRaceConditionTest(SimpleTestCase):
|
||||||
self.assertRegex(files[1], 'conflict_%s' % FILE_SUFFIX_REGEX)
|
self.assertRegex(files[1], 'conflict_%s' % FILE_SUFFIX_REGEX)
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipIf(sys.platform.startswith('win'), "Windows only partially supports umasks and chmod.")
|
@unittest.skipIf(sys.platform == 'win32', "Windows only partially supports umasks and chmod.")
|
||||||
class FileStoragePermissions(unittest.TestCase):
|
class FileStoragePermissions(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.umask = 0o027
|
self.umask = 0o027
|
||||||
|
|
|
@ -376,7 +376,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase):
|
||||||
with self.assertRaisesMessage(management.CommandError, "Unknown model: fixtures.FooModel"):
|
with self.assertRaisesMessage(management.CommandError, "Unknown model: fixtures.FooModel"):
|
||||||
self._dumpdata_assert(['fixtures', 'sites'], '', exclude_list=['fixtures.FooModel'])
|
self._dumpdata_assert(['fixtures', 'sites'], '', exclude_list=['fixtures.FooModel'])
|
||||||
|
|
||||||
@unittest.skipIf(sys.platform.startswith('win'), "Windows doesn't support '?' in filenames.")
|
@unittest.skipIf(sys.platform == 'win32', "Windows doesn't support '?' in filenames.")
|
||||||
def test_load_fixture_with_special_characters(self):
|
def test_load_fixture_with_special_characters(self):
|
||||||
management.call_command('loaddata', 'fixture_with[special]chars', verbosity=0)
|
management.call_command('loaddata', 'fixture_with[special]chars', verbosity=0)
|
||||||
self.assertQuerysetEqual(Article.objects.all(), ['<Article: How To Deal With Special Characters>'])
|
self.assertQuerysetEqual(Article.objects.all(), ['<Article: How To Deal With Special Characters>'])
|
||||||
|
|
|
@ -72,7 +72,7 @@ class FileFieldTests(TestCase):
|
||||||
with self.assertRaises(IntegrityError):
|
with self.assertRaises(IntegrityError):
|
||||||
Document.objects.create(myfile='something.txt')
|
Document.objects.create(myfile='something.txt')
|
||||||
|
|
||||||
@unittest.skipIf(sys.platform.startswith('win'), "Windows doesn't support moving open files.")
|
@unittest.skipIf(sys.platform == 'win32', "Windows doesn't support moving open files.")
|
||||||
# The file's source and destination must be on the same filesystem.
|
# The file's source and destination must be on the same filesystem.
|
||||||
@override_settings(MEDIA_ROOT=temp.gettempdir())
|
@override_settings(MEDIA_ROOT=temp.gettempdir())
|
||||||
def test_move_temporary_file(self):
|
def test_move_temporary_file(self):
|
||||||
|
|
|
@ -420,7 +420,7 @@ class CustomStaticFilesStorage(storage.StaticFilesStorage):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@unittest.skipIf(sys.platform.startswith('win'), "Windows only partially supports chmod.")
|
@unittest.skipIf(sys.platform == 'win32', "Windows only partially supports chmod.")
|
||||||
class TestStaticFilePermissions(CollectionTestCase):
|
class TestStaticFilePermissions(CollectionTestCase):
|
||||||
|
|
||||||
command_params = {
|
command_params = {
|
||||||
|
|
|
@ -196,7 +196,7 @@ class FileSystemLoaderTests(SimpleTestCase):
|
||||||
|
|
||||||
def test_notafile_error(self):
|
def test_notafile_error(self):
|
||||||
# Windows raises PermissionError when trying to open a directory.
|
# Windows raises PermissionError when trying to open a directory.
|
||||||
with self.assertRaises(PermissionError if sys.platform.startswith('win') else IsADirectoryError):
|
with self.assertRaises(PermissionError if sys.platform == 'win32' else IsADirectoryError):
|
||||||
self.engine.get_template('first')
|
self.engine.get_template('first')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -969,7 +969,7 @@ class TemplateTests(SimpleTestCase):
|
||||||
with self.assertRaises(pytz.UnknownTimeZoneError):
|
with self.assertRaises(pytz.UnknownTimeZoneError):
|
||||||
Template("{% load tz %}{% timezone tz %}{% endtimezone %}").render(Context({'tz': 'foobar'}))
|
Template("{% load tz %}{% timezone tz %}{% endtimezone %}").render(Context({'tz': 'foobar'}))
|
||||||
|
|
||||||
@skipIf(sys.platform.startswith('win'), "Windows uses non-standard time zone names")
|
@skipIf(sys.platform == 'win32', "Windows uses non-standard time zone names")
|
||||||
def test_get_current_timezone_templatetag(self):
|
def test_get_current_timezone_templatetag(self):
|
||||||
"""
|
"""
|
||||||
Test the {% get_current_timezone %} templatetag.
|
Test the {% get_current_timezone %} templatetag.
|
||||||
|
@ -1009,7 +1009,7 @@ class TemplateTests(SimpleTestCase):
|
||||||
with self.assertRaisesMessage(TemplateSyntaxError, msg):
|
with self.assertRaisesMessage(TemplateSyntaxError, msg):
|
||||||
Template("{% load tz %}{% get_current_timezone %}").render()
|
Template("{% load tz %}{% get_current_timezone %}").render()
|
||||||
|
|
||||||
@skipIf(sys.platform.startswith('win'), "Windows uses non-standard time zone names")
|
@skipIf(sys.platform == 'win32', "Windows uses non-standard time zone names")
|
||||||
def test_tz_template_context_processor(self):
|
def test_tz_template_context_processor(self):
|
||||||
"""
|
"""
|
||||||
Test the django.template.context_processors.tz template context processor.
|
Test the django.template.context_processors.tz template context processor.
|
||||||
|
|
Loading…
Reference in New Issue