Skip to content

Commit

Permalink
complete reimpl of udocker namespace issue #380
Browse files Browse the repository at this point in the history
  • Loading branch information
mariojmdavid committed Jan 13, 2023
1 parent 4b93418 commit 7ab5c9a
Show file tree
Hide file tree
Showing 38 changed files with 69 additions and 384 deletions.
11 changes: 1 addition & 10 deletions tests/unit/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,14 @@
udocker unit tests: UdockerCLI
"""

import os
import sys

new_path = []
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..")
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../udocker")
new_path.extend(sys.path)
sys.path = new_path

from unittest import TestCase, main
from unittest.mock import Mock, patch
from udocker.config import Config
from udocker.cmdparser import CmdParser
from udocker.cli import UdockerCLI
import collections
collections.Callable = collections.abc.Callable

collections.Callable = collections.abc.Callable
BUILTIN = "builtins"
BOPEN = BUILTIN + '.open'

Expand Down
10 changes: 1 addition & 9 deletions tests/unit/test_cmdparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,10 @@
udocker unit tests: CmdParser
"""

import os
import sys

new_path = []
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..")
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../udocker")
new_path.extend(sys.path)
sys.path = new_path

from unittest import TestCase, main
from udocker.cmdparser import CmdParser
import collections

collections.Callable = collections.abc.Callable


Expand Down
10 changes: 1 addition & 9 deletions tests/unit/test_commonlocalfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,11 @@
udocker unit tests: CommonLocalFileApi
"""

import os
import sys

new_path = []
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..")
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../udocker")
new_path.extend(sys.path)
sys.path = new_path

from unittest import TestCase, main
from unittest.mock import Mock, patch
from udocker.commonlocalfile import CommonLocalFileApi
import collections

collections.Callable = collections.abc.Callable


Expand Down
12 changes: 1 addition & 11 deletions tests/unit/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,12 @@
udocker unit tests: Config
"""


import os
import sys

new_path = []
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..")
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../udocker")
new_path.extend(sys.path)
sys.path = new_path

from unittest import TestCase, main
from unittest.mock import patch
from udocker.config import Config
import collections
collections.Callable = collections.abc.Callable

collections.Callable = collections.abc.Callable
BUILTINS = "builtins"


Expand Down
17 changes: 4 additions & 13 deletions tests/unit/test_containerstructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,12 @@
udocker unit tests: ContainerStructure
"""

import os
import sys

new_path = []
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..")
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../udocker")
new_path.extend(sys.path)
sys.path = new_path

from unittest import TestCase, main
from unittest.mock import patch, Mock
from udocker.container.structure import ContainerStructure
from config import Config
from udocker.config import Config
import collections

collections.Callable = collections.abc.Callable


Expand All @@ -29,9 +21,8 @@ def setUp(self):
Config().getconf()
Config().conf['hostauth_list'] = ("/etc/passwd", "/etc/group")
Config().conf['cmd'] = "/bin/bash"
Config().conf['cpu_affinity_exec_tools'] = \
(["numactl", "-C", "%s", "--", ],
["taskset", "-c", "%s", ])
Config().conf['cpu_affinity_exec_tools'] = (["numactl", "-C", "%s", "--", ],
["taskset", "-c", "%s", ])
Config().conf['valid_host_env'] = "HOME"
Config().conf['username'] = "user"
Config().conf['userhome'] = "/"
Expand Down
15 changes: 3 additions & 12 deletions tests/unit/test_curl.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,17 @@
udocker unit tests: CurlHeader
"""

import os
import sys

new_path = []
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..")
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../udocker")
new_path.extend(sys.path)
sys.path = new_path

from unittest import TestCase, main
from unittest.mock import patch
from io import StringIO
from udocker.utils.curl import CurlHeader
from udocker.utils.curl import GetURL
from udocker.utils.curl import GetURLpyCurl
from udocker.utils.curl import GetURLexeCurl
from config import Config
from udocker.config import Config
import collections
collections.Callable = collections.abc.Callable

collections.Callable = collections.abc.Callable
BUILTINS = "builtins"


Expand Down Expand Up @@ -134,7 +125,7 @@ def test_02__select_implementation(self, mock_gupycurl,
mock_gupycurl.return_value = True
geturl = GetURL()
geturl._select_implementation()
self.assertTrue(geturl.cache_support)
# self.assertTrue(geturl.cache_support)

mock_gupycurl.return_value = False
geturl = GetURL()
Expand Down
11 changes: 1 addition & 10 deletions tests/unit/test_curlheader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,13 @@
udocker unit tests: CurlHeader
"""

import os
import sys

new_path = []
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..")
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../udocker")
new_path.extend(sys.path)
sys.path = new_path

from unittest import TestCase, main
from unittest.mock import patch
from io import StringIO
from udocker.utils.curl import CurlHeader
import collections
collections.Callable = collections.abc.Callable

collections.Callable = collections.abc.Callable
BUILTINS = "builtins"


Expand Down
12 changes: 2 additions & 10 deletions tests/unit/test_dockerioapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,13 @@
udocker unit tests: DockerIoAPI
"""

import os
import sys

new_path = []
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..")
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../udocker")
new_path.extend(sys.path)
sys.path = new_path

from unittest import TestCase, main
from unittest.mock import patch, Mock
from io import BytesIO as strio
from udocker.docker import DockerIoAPI
from config import Config
from udocker.config import Config
import collections

collections.Callable = collections.abc.Callable


Expand Down
12 changes: 2 additions & 10 deletions tests/unit/test_dockerlocalfileapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,12 @@
udocker unit tests: DockerLocalFileAPI
"""

import os
import sys

new_path = []
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..")
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../udocker")
new_path.extend(sys.path)
sys.path = new_path

from unittest import TestCase, main
from unittest.mock import patch, Mock
from udocker.docker import DockerLocalFileAPI
from config import Config
from udocker.config import Config
import collections

collections.Callable = collections.abc.Callable


Expand Down
12 changes: 2 additions & 10 deletions tests/unit/test_elfpatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,12 @@
udocker unit tests: ElfPatcher
"""

import os
import sys

new_path = []
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..")
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../udocker")
new_path.extend(sys.path)
sys.path = new_path

from unittest import TestCase, main
from unittest.mock import patch, Mock
from udocker.helper.elfpatcher import ElfPatcher
from config import Config
from udocker.config import Config
import collections

collections.Callable = collections.abc.Callable


Expand Down
12 changes: 2 additions & 10 deletions tests/unit/test_execenginecommon.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,13 @@
udocker unit tests: ExecutionEngineCommon
"""

import os
import sys

new_path = []
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..")
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../udocker")
new_path.extend(sys.path)
sys.path = new_path

from unittest import TestCase, main
from unittest.mock import Mock, patch
from udocker.engine.base import ExecutionEngineCommon
from udocker.utils.uenv import Uenv
from config import Config
from udocker.config import Config
import collections

collections.Callable = collections.abc.Callable


Expand Down
20 changes: 6 additions & 14 deletions tests/unit/test_executionmode.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,16 @@
udocker unit tests: ExecutionMode
"""

import os
import sys

new_path = []
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..")
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../udocker")
new_path.extend(sys.path)
sys.path = new_path

from unittest import TestCase, main
from unittest.mock import Mock, patch
from udocker.engine.execmode import ExecutionMode
from engine.proot import PRootEngine
from engine.runc import RuncEngine
from engine.fakechroot import FakechrootEngine
from engine.singularity import SingularityEngine
from config import Config
from udocker.engine.proot import PRootEngine
from udocker.engine.runc import RuncEngine
from udocker.engine.fakechroot import FakechrootEngine
from udocker.engine.singularity import SingularityEngine
from udocker.config import Config
import collections

collections.Callable = collections.abc.Callable


Expand Down
11 changes: 2 additions & 9 deletions tests/unit/test_fakechroot.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,12 @@
"""

import os
import sys

new_path = []
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..")
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../udocker")
new_path.extend(sys.path)
sys.path = new_path

from unittest import TestCase, main
from unittest.mock import patch, Mock
from config import Config
from udocker.config import Config
from udocker.engine.fakechroot import FakechrootEngine
import collections

collections.Callable = collections.abc.Callable


Expand Down
12 changes: 2 additions & 10 deletions tests/unit/test_filebind.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,12 @@
udocker unit tests: FileBind
"""

import os
import sys

new_path = []
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..")
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../udocker")
new_path.extend(sys.path)
sys.path = new_path

from unittest import TestCase, main
from unittest.mock import Mock, patch
from udocker.utils.filebind import FileBind
from config import Config
from udocker.config import Config
import collections

collections.Callable = collections.abc.Callable


Expand Down
12 changes: 2 additions & 10 deletions tests/unit/test_fileutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,12 @@

import os
import sys

new_path = []
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../..")
new_path.append(os.path.dirname(os.path.realpath(__file__)) + "/../../udocker")
new_path.extend(sys.path)
sys.path = new_path

import sys
import os
from unittest import TestCase, main
from unittest.mock import patch, mock_open
from udocker.utils.fileutil import FileUtil
from config import Config
from udocker.config import Config
import collections

collections.Callable = collections.abc.Callable

STDOUT = sys.stdout
Expand Down
Loading

0 comments on commit 7ab5c9a

Please sign in to comment.