Facing test issues on ppc64le architecture

======================================================================
FAIL: test_readonly_root (file_uploads.tests.DirectoryCreationTests.test_readonly_root)
Permission errors are not swallowed

Traceback (most recent call last):
File “/usr/lib64/python3.11/unittest/case.py”, line 57, in testPartExecutor
yield
File “/usr/lib64/python3.11/unittest/case.py”, line 623, in run
self._callTestMethod(testMethod)
^^^^^^^^^^^^^^^^^
File “/usr/lib64/python3.11/unittest/case.py”, line 579, in _callTestMethod
if method() is not None:
^^^^^^^^^^^^^^^^^
File “/django/django/test/utils.py”, line 443, in inner
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^
File “/django/tests/file_uploads/tests.py”, line 822, in test_readonly_root
with self.assertRaises(PermissionError):
^^^^^^^^^^^^^^^^^
File “/usr/lib64/python3.11/unittest/case.py”, line 262, in exit
self._raiseFailure(“{} not raised”.format(exc_name))
^^^^^^^^^^^^^^^^^
File “/usr/lib64/python3.11/unittest/case.py”, line 199, in _raiseFailure
raise self.test_case.failureException(msg)
^^^^^^^^^^^^^^^^^
AssertionError: PermissionError not raised

======================================================================
FAIL: test_permissions_error (template_tests.test_loaders.FileSystemLoaderTests.test_permissions_error)

Traceback (most recent call last):
File “/usr/lib64/python3.11/unittest/case.py”, line 57, in testPartExecutor
yield
File “/usr/lib64/python3.11/unittest/case.py”, line 623, in run
self._callTestMethod(testMethod)
^^^^^^^^^^^^^^^^^
File “/usr/lib64/python3.11/unittest/case.py”, line 579, in _callTestMethod
if method() is not None:
^^^^^^^^^^^^^^^^^
File “/django/tests/template_tests/test_loaders.py”, line 226, in test_permissions_error
with self.assertRaisesMessage(PermissionError, “Permission denied”):
^^^^^^^^^^^^^^^^^
File “/usr/lib64/python3.11/contextlib.py”, line 144, in exit
next(self.gen)
File “/django/django/test/testcases.py”, line 740, in _assert_raises_or_warns_cm
with func(expected_exception) as cm:
^^^^^^^^^^^^^^^^^
File “/usr/lib64/python3.11/unittest/case.py”, line 262, in exit
self._raiseFailure(“{} not raised”.format(exc_name))
^^^^^^^^^^^^^^^^^
File “/usr/lib64/python3.11/unittest/case.py”, line 199, in _raiseFailure
raise self.test_case.failureException(msg)
^^^^^^^^^^^^^^^^^
AssertionError: PermissionError not raised


Ran 16209 tests in 544.544s

FAILED (failures=2, skipped=1161, expected failures=5)
Destroying test database for alias ‘default’ (‘file:memorydb_default?mode=memory&cache=shared’)…
Destroying test database for alias ‘default’ (‘file:memorydb_default?mode=memory&cache=shared’)…
Destroying test database for alias ‘default’ (‘file:memorydb_default?mode=memory&cache=shared’)…
Destroying test database for alias ‘default’ (‘file:memorydb_default?mode=memory&cache=shared’)…
Destroying test database for alias ‘default’ (‘file:memorydb_default?mode=memory&cache=shared’)…
Destroying test database for alias ‘default’ (‘file:memorydb_default?mode=memory&cache=shared’)…
Destroying test database for alias ‘default’ (‘file:memorydb_default?mode=memory&cache=shared’)…
Destroying test database for alias ‘default’ (‘file:memorydb_default?mode=memory&cache=shared’)…
Destroying test database for alias ‘default’ (‘file:memorydb_default?mode=memory&cache=shared’)…
Destroying test database for alias ‘other’ (‘file:memorydb_other?mode=memory&cache=shared’)…
Destroying test database for alias ‘other’ (‘file:memorydb_other?mode=memory&cache=shared’)…
Destroying test database for alias ‘other’ (‘file:memorydb_other?mode=memory&cache=shared’)…
Destroying test database for alias ‘other’ (‘file:memorydb_other?mode=memory&cache=shared’)…
Destroying test database for alias ‘other’ (‘file:memorydb_other?mode=memory&cache=shared’)…
Destroying test database for alias ‘other’ (‘file:memorydb_other?mode=memory&cache=shared’)…
Destroying test database for alias ‘other’ (‘file:memorydb_other?mode=memory&cache=shared’)…
Destroying test database for alias ‘other’ (‘file:memorydb_other?mode=memory&cache=shared’)…
Destroying test database for alias ‘other’ (‘file:memorydb_other?mode=memory&cache=shared’)…

me thinks the fs is full :joy: :crazy_face:

Permission errors are not swallowed

more seriously though, we cannot help with so little information.

When i was running the tests with below command facing the tests issues

Test command used python3.12 tests/runtests.py -v2

======================================================================
FAIL: test_readonly_root (file_uploads.tests.DirectoryCreationTests.test_readonly_root)
Permission errors are not swallowed
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.11/unittest/case.py", line 57, in testPartExecutor
    yield
  File "/usr/lib64/python3.11/unittest/case.py", line 623, in run
    self._callTestMethod(testMethod)
    ^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/unittest/case.py", line 579, in _callTestMethod
    if method() is not None:
    ^^^^^^^^^^^^^^^^^
  File "/django/django/test/utils.py", line 443, in inner
    return func(*args, **kwargs)
    ^^^^^^^^^^^^^^^^^
  File "/django/tests/file_uploads/tests.py", line 822, in test_readonly_root
    with self.assertRaises(PermissionError):
    ^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/unittest/case.py", line 262, in __exit__
    self._raiseFailure("{} not raised".format(exc_name))
    ^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/unittest/case.py", line 199, in _raiseFailure
    raise self.test_case.failureException(msg)
    ^^^^^^^^^^^^^^^^^
AssertionError: PermissionError not raised

======================================================================
FAIL: test_permissions_error (template_tests.test_loaders.FileSystemLoaderTests.test_permissions_error)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib64/python3.11/unittest/case.py", line 57, in testPartExecutor
    yield
  File "/usr/lib64/python3.11/unittest/case.py", line 623, in run
    self._callTestMethod(testMethod)
    ^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/unittest/case.py", line 579, in _callTestMethod
    if method() is not None:
    ^^^^^^^^^^^^^^^^^
  File "/django/tests/template_tests/test_loaders.py", line 226, in test_permissions_error
    with self.assertRaisesMessage(PermissionError, "Permission denied"):
    ^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/contextlib.py", line 144, in __exit__
    next(self.gen)
  File "/django/django/test/testcases.py", line 740, in _assert_raises_or_warns_cm
    with func(expected_exception) as cm:
    ^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/unittest/case.py", line 262, in __exit__
    self._raiseFailure("{} not raised".format(exc_name))
    ^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/unittest/case.py", line 199, in _raiseFailure
    raise self.test_case.failureException(msg)
    ^^^^^^^^^^^^^^^^^
AssertionError: PermissionError not raised

----------------------------------------------------------------------
Ran 16209 tests in 544.544s

FAILED (failures=2, skipped=1161, expected failures=5)
Destroying test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...
Destroying test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...
Destroying test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...
Destroying test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...
Destroying test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...
Destroying test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...
Destroying test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...
Destroying test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...
Destroying test database for alias 'default' ('file:memorydb_default?mode=memory&cache=shared')...
Destroying test database for alias 'other' ('file:memorydb_other?mode=memory&cache=shared')...
Destroying test database for alias 'other' ('file:memorydb_other?mode=memory&cache=shared')...
Destroying test database for alias 'other' ('file:memorydb_other?mode=memory&cache=shared')...
Destroying test database for alias 'other' ('file:memorydb_other?mode=memory&cache=shared')...
Destroying test database for alias 'other' ('file:memorydb_other?mode=memory&cache=shared')...
Destroying test database for alias 'other' ('file:memorydb_other?mode=memory&cache=shared')...
Destroying test database for alias 'other' ('file:memorydb_other?mode=memory&cache=shared')...
Destroying test database for alias 'other' ('file:memorydb_other?mode=memory&cache=shared')...
Destroying test database for alias 'other' ('file:memorydb_other?mode=memory&cache=shared')...

do you have some (stripped down, perhaps simplified code) we could see? because the information you are showing makes it hard for anyone to help :slight_smile:

for all we know, that might even be not django-related

I’m facing issue in this code

@override_settings(MEDIA_ROOT=MEDIA_ROOT)
class DirectoryCreationTests(SimpleTestCase):
    """
    Tests for error handling during directory creation
    via _save_FIELD_file (ticket #6450)
    """

    @classmethod
    def setUpClass(cls):
        super().setUpClass()
        os.makedirs(MEDIA_ROOT, exist_ok=True)
        cls.addClassCleanup(shutil.rmtree, MEDIA_ROOT)

    def setUp(self):
        self.obj = FileModel()

    @unittest.skipIf(
        sys.platform == "win32", "Python on Windows doesn't have working os.chmod()."
    )
    @override_settings(
        STORAGES={
            DEFAULT_STORAGE_ALIAS: {
                "BACKEND": "django.core.files.storage.FileSystemStorage",
            }
        }
    )
    def test_readonly_root(self):
        """Permission errors are not swallowed"""
        os.chmod(MEDIA_ROOT, 0o500)
        self.addCleanup(os.chmod, MEDIA_ROOT, 0o700)
        with self.assertRaises(PermissionError):
            self.obj.testfile.save(
                "foo.txt", SimpleUploadedFile("foo.txt", b"x"), save=False
            )```