Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Some tests failed in container environments #4

@guoyunhe

Description

@guoyunhe

We are happy to answer your questions about the code or discuss technical ideas.

Please complete the following checklist (by adding [x]):

  • I have searched open and closed issues for duplicates
  • This isn't a feature request
  • This is not a report about my app not working as expected

I am trying to updating this package on openSUSE RPM repository. Some of the tests are failing because the code cannot access /var/user in the container environment:

[    6s] tests/connection/test_vpnconfiguration.py:111: 
[    6s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[    6s] proton/vpn/connection/vpnconfiguration.py:64: in __enter__
[    6s]     self._delete_existing_configuration()
[    6s] proton/vpn/connection/vpnconfiguration.py:89: in _delete_existing_configuration
[    6s]     for file in self.__base_path:
[    6s] proton/vpn/connection/vpnconfiguration.py:99: in __base_path
[    6s]     return ExecutionEnvironment().path_runtime
[    6s] /usr/lib/python3.10/site-packages/proton/utils/environment.py:57: in path_runtime
[    6s]     self.generate_dirs(self._path_runtime)
[    6s] /usr/lib/python3.10/site-packages/proton/utils/environment.py:68: in generate_dirs
[    6s]     os.makedirs(path, mode=0o700, exist_ok=True)
[    6s] /usr/lib64/python3.10/os.py:215: in makedirs
[    6s]     makedirs(head, exist_ok=exist_ok)
[    6s] /usr/lib64/python3.10/os.py:215: in makedirs
[    6s]     makedirs(head, exist_ok=exist_ok)
[    6s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[    6s] 
[    6s] name = '/run/user', mode = 511, exist_ok = True
[    6s] 
[    6s]     def makedirs(name, mode=0o777, exist_ok=False):
[    6s]         """makedirs(name [, mode=0o777][, exist_ok=False])
[    6s]     
[    6s]         Super-mkdir; create a leaf directory and all intermediate ones.  Works like
[    6s]         mkdir, except that any intermediate path segment (not just the rightmost)
[    6s]         will be created if it does not exist. If the target directory already
[    6s]         exists, raise an OSError if exist_ok is False. Otherwise no exception is
[    6s]         raised.  This is recursive.
[    6s]     
[    6s]         """
[    6s]         head, tail = path.split(name)
[    6s]         if not tail:
[    6s]             head, tail = path.split(head)
[    6s]         if head and tail and not path.exists(head):
[    6s]             try:
[    6s]                 makedirs(head, exist_ok=exist_ok)
[    6s]             except FileExistsError:
[    6s]                 # Defeats race condition when another thread created the path
[    6s]                 pass
[    6s]             cdir = curdir
[    6s]             if isinstance(tail, bytes):
[    6s]                 cdir = bytes(curdir, 'ASCII')
[    6s]             if tail == cdir:           # xxx/newdir/. exists if xxx/newdir exists
[    6s]                 return
[    6s]         try:
[    6s] >           mkdir(name, mode)
[    6s] E           PermissionError: [Errno 13] Permission denied: '/run/user'
[    6s] 
[    6s] /usr/lib64/python3.10/os.py:225: PermissionError

Any idea how to fix it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions