rope icon indicating copy to clipboard operation
rope copied to clipboard

AutoImportTest.test_skipping_directories_not_accessible_because_of_permission_error test fails with Python 3.13.0b2

Open arkamar opened this issue 8 months ago • 0 comments

I tried to test rope 1.13.0 with Python 3.13.0b2 and one test fail. Here is the log output just for this test:

================================================= test session starts =================================================                                                                                                                [92/621]
platform linux -- Python 3.13.0b2, pytest-8.2.2, pluggy-1.5.0 -- /var/tmp/portage/dev-python/rope-1.13.0/work/rope-1.13.0-python3_13/install/usr/bin/python3.13
cachedir: .pytest_cache
rootdir: /var/tmp/portage/dev-python/rope-1.13.0/work/rope-1.13.0
configfile: pyproject.toml
plugins: timeout-2.3.1
collecting ... collected 1 item

ropetest/contrib/autoimporttest.py::AutoImportTest::test_skipping_directories_not_accessible_because_of_permission_error FAILED [1/1]

====================================================== FAILURES =======================================================
_________________ AutoImportTest.test_skipping_directories_not_accessible_because_of_permission_error _________________

self = <ropetest.contrib.autoimporttest.AutoImportTest testMethod=test_skipping_directories_not_accessible_because_of_permission_error>

    def test_skipping_directories_not_accessible_because_of_permission_error(self):
        # The single thread test takes much longer than the multithread test but is easier to debug
        single_thread = False
        self.importer.generate_modules_cache(single_thread=single_thread)

        # Create a temporary directory and set permissions to 000
        import sys
        import tempfile
        with tempfile.TemporaryDirectory() as dir:
            import os
            os.chmod(dir, 0o000)
            self.importer.project.prefs.python_path = [dir]
>           self.importer.generate_modules_cache(single_thread=single_thread)

dir        = '/var/tmp/portage/dev-python/rope-1.13.0/temp/tmpnqvx8oa_'
os         = <module 'os' (frozen)>
self       = <ropetest.contrib.autoimporttest.AutoImportTest testMethod=test_skipping_directories_not_accessible_because_of_permission_error>
single_thread = False
sys        = <module 'sys' (built-in)>
tempfile   = <module 'tempfile' from '/usr/lib/python3.13/tempfile.py'>

ropetest/contrib/autoimporttest.py:175:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
rope/contrib/autoimport/sqlite.py:422: in generate_modules_cache
    self._get_available_packages()
        modules    = None
        self       = <rope.contrib.autoimport.sqlite.AutoImport object at 0x7fd1a12fd7f0>
        single_thread = False
        task_handle = <rope.base.taskhandle.NullTaskHandle object at 0x7fd1a1d19e80>
        underlined = False
rope/contrib/autoimport/sqlite.py:587: in _get_available_packages
    for package in self._safe_iterdir(folder):
        folder     = PosixPath('/var/tmp/portage/dev-python/rope-1.13.0/temp/tmpnqvx8oa_')
        packages   = [Package(name='_abc', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_ast', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_codecs', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_collections', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_functools', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_imp', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_io', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_locale', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_operator', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_signal', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_sre', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_stat', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_string', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_suggestions', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),                                                                                                                                   [31/621]
 Package(name='_symtable', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_sysconfig', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_thread', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_tokenize', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_tracemalloc', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_typing', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_warnings', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='_weakref', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='atexit', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='builtins', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='errno', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='faulthandler', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='gc', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='itertools', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='marshal', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='posix', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='pwd', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='sys', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>),
 Package(name='time', source=<Source.BUILTIN: 2>, path=None, type=<PackageType.BUILTIN: 0>)]
        self       = <rope.contrib.autoimport.sqlite.AutoImport object at 0x7fd1a12fd7f0>
rope/contrib/autoimport/sqlite.py:572: in _safe_iterdir
    dirs = folder.iterdir()
        folder     = PosixPath('/var/tmp/portage/dev-python/rope-1.13.0/temp/tmpnqvx8oa_')
        self       = <rope.contrib.autoimport.sqlite.AutoImport object at 0x7fd1a12fd7f0>
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = PosixPath('/var/tmp/portage/dev-python/rope-1.13.0/temp/tmpnqvx8oa_')

    def iterdir(self):
        """Yield path objects of the directory contents.

        The children are yielded in arbitrary order, and the
        special entries '.' and '..' are not included.
        """
        root_dir = str(self)
>       with os.scandir(root_dir) as scandir_it:
E       PermissionError: [Errno 13] Permission denied: '/var/tmp/portage/dev-python/rope-1.13.0/temp/tmpnqvx8oa_'

root_dir   = '/var/tmp/portage/dev-python/rope-1.13.0/temp/tmpnqvx8oa_'
self       = PosixPath('/var/tmp/portage/dev-python/rope-1.13.0/temp/tmpnqvx8oa_')

/usr/lib/python3.13/pathlib/_local.py:575: PermissionError
------------------------------------------------ Captured stdout call -------------------------------------------------
(unicode error) 'utf-8' codec can't decode byte 0xf6 in position 1: invalid start byte (<string>, line 1)
invalid character '€' (U+20AC) (<string>, line 2)
encoding problem: utf8 with BOM (<string>, line 0)
unknown encoding: uft-8 (<string>, line 0)
================================================== warnings summary ===================================================
ropetest/contrib/autoimporttest.py::AutoImportTest::test_skipping_directories_not_accessible_because_of_permission_error
  /var/tmp/portage/dev-python/rope-1.13.0/work/rope-1.13.0/rope/base/project.py:230: DeprecationWarning: Delete once deprecated functions are gone
    self._init_source_folders()

ropetest/contrib/autoimporttest.py::AutoImportTest::test_skipping_directories_not_accessible_because_of_permission_error
  /var/tmp/portage/dev-python/rope-1.13.0/work/rope-1.13.0/rope/contrib/autoimport/sqlite.py:139: DeprecationWarning: The default value for `AutoImport(memory)` argument will change to use an on-disk database by default in the future. If y
ou want to use an in-memory database, you need to pass `AutoImport(memory=True)` explicitly.
    warnings.warn(

ropetest/contrib/autoimporttest.py::AutoImportTest::test_skipping_directories_not_accessible_because_of_permission_error
  /var/tmp/portage/dev-python/rope-1.13.0/work/rope-1.13.0/rope/contrib/autoimport/sqlite.py:507: DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to rep
resent datetimes in UTC: datetime.datetime.now(datetime.UTC).
    datetime.utcnow().isoformat(),

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=============================================== short test summary info ===============================================
FAILED ropetest/contrib/autoimporttest.py::AutoImportTest::test_skipping_directories_not_accessible_because_of_permission_error - PermissionError: [Errno 13] Permission denied: '/var/tmp/portage/dev-python/rope-1.13.0/temp/tmpnqvx8oa_'
============================================ 1 failed, 3 warnings in 3.97s ============================================

arkamar avatar Jun 24 '24 09:06 arkamar