Skip to content

Commit

Permalink
🐛 Fix makedirs permission issue
Browse files Browse the repository at this point in the history
  • Loading branch information
shnizzedy committed Apr 12, 2022
1 parent 4cdae07 commit 82ec7c7
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ __pycache__/*
.cache/*
.*.swp
*/.ipynb_checkpoints/*
tmp

# Project files
.ropeproject
Expand Down Expand Up @@ -49,4 +50,5 @@ MANIFEST
.venv*/

# Singularity Images
**/*.simg
**/*.simg
**/*.sif
2 changes: 1 addition & 1 deletion src/cpac/backends/platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def _prep_binding(self, volume: Volume,
)
if not os.path.exists(volume.local):
try:
os.makedirs(volume.local, mode=777)
os.makedirs(volume.local, exist_ok=True)
except PermissionError as perm:
if second_try:
raise perm
Expand Down
5 changes: 1 addition & 4 deletions src/cpac/helpers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@
'persists, run\n '
r'2. `docker attach <container_name>`'
'\n '
r'3. `exit`',
'permission_denied': 'Pytest is getting "permission denied" errors '
'writing to tmp directories, but running '
'outside of Pytest is working locally'}
r'3. `exit`'}


def get_extra_arg_value(extra_args, argument):
Expand Down
1 change: 0 additions & 1 deletion src/cpac/helpers/cpac_read_crash.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import os
import re

from sys import argv

path_regex = re.compile(
Expand Down
2 changes: 2 additions & 0 deletions src/cpac/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ def __init__(self, local: str, bind: str = None,
def __init__(self, local, bind=None, mode=None): # noqa: E301
self.local = local
self.bind = bind if bind is not None else local
if self.bind is not None and not self.bind.startswith('/'):
self.bind = os.path.abspath(self.bind)
if isinstance(mode, PermissionMode):
self.mode = mode
elif mode is not None:
Expand Down
2 changes: 1 addition & 1 deletion tests/CONSTANTS.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'''Constants for tests'''
# pylint: disable=invalid-name
TAGS = [None, 'latest', 'nightly'
TAGS = [None, 'latest', 'nightly']


def args_before_after(argv, args):
Expand Down
1 change: 0 additions & 1 deletion tests/test_cpac_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def run_test(argv):
run_test(f'cpac {argv}'.split(' '))


@pytest.mark.skip(reason=TODOs['permission_denied'])
@pytest.mark.parametrize('argsep', [' ', '='])
@pytest.mark.parametrize('pipeline_file', [None, MINIMAL_CONFIG])
def test_run_test_config(argsep, pipeline_file, tmp_path, platform, tag):
Expand Down
1 change: 0 additions & 1 deletion tests/test_cpac_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def run_test(argv, platform):
run_test(f'cpac {argv}'.split(' '), platform)


@pytest.mark.skip(reason=TODOs['permission_denied'])
@pytest.mark.parametrize('argsep', [' ', '='])
def test_utils_new_settings_template(argsep, tmp_path, platform, tag):
"""Test 'utils data_config new_settings_template' command"""
Expand Down

0 comments on commit 82ec7c7

Please sign in to comment.