diff --git a/tests/admin_filters/tests.py b/tests/admin_filters/tests.py index ce659f937f..6db2147e51 100644 --- a/tests/admin_filters/tests.py +++ b/tests/admin_filters/tests.py @@ -460,7 +460,7 @@ class ListFiltersTests(TestCase): self.assertEqual(choice['query_string'], '?date_registered__isnull=False') @unittest.skipIf( - sys.platform.startswith('win'), + sys.platform == 'win32', "Windows doesn't support setting a timezone that differs from the " "system timezone." ) diff --git a/tests/asgi/tests.py b/tests/asgi/tests.py index eee12b95ba..3a26d3130f 100644 --- a/tests/asgi/tests.py +++ b/tests/asgi/tests.py @@ -78,7 +78,7 @@ class ASGITest(SimpleTestCase): set(response_start['headers']), { (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"'), }, ) diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py index be6e11de93..9b41f5250d 100644 --- a/tests/file_storage/tests.py +++ b/tests/file_storage/tests.py @@ -771,7 +771,7 @@ class FileFieldStorageTests(TestCase): o.delete() @unittest.skipIf( - sys.platform.startswith('win'), + sys.platform == 'win32', "Windows supports at most 260 characters in a path.", ) def test_extended_length_storage(self): @@ -897,7 +897,7 @@ class FileSaveRaceConditionTest(SimpleTestCase): 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): def setUp(self): self.umask = 0o027 diff --git a/tests/fixtures/tests.py b/tests/fixtures/tests.py index 7390ab54f9..02dd38e635 100644 --- a/tests/fixtures/tests.py +++ b/tests/fixtures/tests.py @@ -376,7 +376,7 @@ class FixtureLoadingTests(DumpDataAssertMixin, TestCase): with self.assertRaisesMessage(management.CommandError, "Unknown model: 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): management.call_command('loaddata', 'fixture_with[special]chars', verbosity=0) self.assertQuerysetEqual(Article.objects.all(), ['']) diff --git a/tests/model_fields/test_filefield.py b/tests/model_fields/test_filefield.py index 9330a2eba2..9642e7e80b 100644 --- a/tests/model_fields/test_filefield.py +++ b/tests/model_fields/test_filefield.py @@ -72,7 +72,7 @@ class FileFieldTests(TestCase): with self.assertRaises(IntegrityError): 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. @override_settings(MEDIA_ROOT=temp.gettempdir()) def test_move_temporary_file(self): diff --git a/tests/staticfiles_tests/test_storage.py b/tests/staticfiles_tests/test_storage.py index afdf4c1761..c6f6e4fb4e 100644 --- a/tests/staticfiles_tests/test_storage.py +++ b/tests/staticfiles_tests/test_storage.py @@ -420,7 +420,7 @@ class CustomStaticFilesStorage(storage.StaticFilesStorage): 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): command_params = { diff --git a/tests/template_tests/test_loaders.py b/tests/template_tests/test_loaders.py index 3c5282a8ea..258b18fca0 100644 --- a/tests/template_tests/test_loaders.py +++ b/tests/template_tests/test_loaders.py @@ -196,7 +196,7 @@ class FileSystemLoaderTests(SimpleTestCase): def test_notafile_error(self): # 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') diff --git a/tests/timezones/tests.py b/tests/timezones/tests.py index e57e12d6c4..a317af5a55 100644 --- a/tests/timezones/tests.py +++ b/tests/timezones/tests.py @@ -969,7 +969,7 @@ class TemplateTests(SimpleTestCase): with self.assertRaises(pytz.UnknownTimeZoneError): 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): """ Test the {% get_current_timezone %} templatetag. @@ -1009,7 +1009,7 @@ class TemplateTests(SimpleTestCase): with self.assertRaisesMessage(TemplateSyntaxError, msg): 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): """ Test the django.template.context_processors.tz template context processor.