Hello All,
The latest version of the Proton VPN app (4.4.4) for Linux came out recently with Wireguard support, and I decided I’d try to branch @avicenzi repos and give it a shot myself to try and learn. However, I ran into something I can’t seem to google my way out of. One of the requirements for the new app is an updated version of https://build.opensuse.org/package/show/openSUSE:Factory/python-proton-vpn-api-core. When I build it, it runs a bunch of Python tests at the end. Some of those tests are failing because the build user does not have root privileges:
==================================== ERRORS ====================================
[ 11s] _________ ERROR at setup of test_ensure_configuration_file_is_created __________
[ 11s]
[ 11s] @pytest.fixture
[ 11s] def modified_exec_env():
[ 11s] from proton.utils.environment import ExecutionEnvironment
[ 11s] > m = ExecutionEnvironment().path_runtime
[ 11s]
[ 11s] tests/connection/test_vpnconfiguration.py:48:
[ 11s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 11s] /usr/lib/python3.10/site-packages/proton/utils/environment.py:57: in path_runtime
[ 11s] self.generate_dirs(self._path_runtime)
[ 11s] /usr/lib/python3.10/site-packages/proton/utils/environment.py:68: in generate_dirs
[ 11s] os.makedirs(path, mode=0o700, exist_ok=True)
[ 11s] /usr/lib64/python3.10/os.py:215: in makedirs
[ 11s] makedirs(head, exist_ok=exist_ok)
[ 11s] /usr/lib64/python3.10/os.py:215: in makedirs
[ 11s] makedirs(head, exist_ok=exist_ok)
[ 11s] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[ 11s]
[ 11s] name = '/run/user', mode = 511, exist_ok = True
[ 11s]
[ 11s] def makedirs(name, mode=0o777, exist_ok=False):
[ 11s] """makedirs(name [, mode=0o777][, exist_ok=False])
[ 11s]
[ 11s] Super-mkdir; create a leaf directory and all intermediate ones. Works like
[ 11s] mkdir, except that any intermediate path segment (not just the rightmost)
[ 11s] will be created if it does not exist. If the target directory already
[ 11s] exists, raise an OSError if exist_ok is False. Otherwise no exception is
[ 11s] raised. This is recursive.
[ 11s]
[ 11s] """
[ 11s] head, tail = path.split(name)
[ 11s] if not tail:
[ 11s] head, tail = path.split(head)
[ 11s] if head and tail and not path.exists(head):
[ 11s] try:
[ 11s] makedirs(head, exist_ok=exist_ok)
[ 11s] except FileExistsError:
[ 11s] # Defeats race condition when another thread created the path
[ 11s] pass
[ 11s] cdir = curdir
[ 11s] if isinstance(tail, bytes):
[ 11s] cdir = bytes(curdir, 'ASCII')
[ 11s] if tail == cdir: # xxx/newdir/. exists if xxx/newdir exists
[ 11s] return
[ 11s] try:
[ 11s] > mkdir(name, mode)
[ 11s] E PermissionError: [Errno 13] Permission denied: '/run/user'
[ 11s]
[ 11s] /usr/lib64/python3.10/os.py:225: PermissionError
There are several other tests that fail in this same way. How would I work around this? Or, are these tests not really important here? Some GUI tests are disabled in the main Proton VPN package with %pytest tests/unit --ignore=tests/unit/widgets/
, I guess these might be disabled in the same way if needed.
Thanks!