예제 #1
0
    def test_resolve_local(self):
        origpath = os.getcwd()
        os.chdir(os.path.join(get_data("")))

        def norm(uri):
            if onWindows():
                return uri.lower()
            else:
                return uri
        try:
            root = Path.cwd()
            rooturi = root.as_uri()
            self.assertEqual(norm(rooturi+"/tests/echo.cwl"),
                    norm(resolve_local(None, os.path.join("tests",
                        "echo.cwl"))))
            self.assertEqual(norm(rooturi+"/tests/echo.cwl#main"),
                    norm(resolve_local(None, os.path.join("tests",
                        "echo.cwl")+"#main")))
            self.assertEqual(norm(rooturi+"/tests/echo.cwl"),
                    norm(resolve_local(None, str(root / "tests" /
                        "echo.cwl"))))
            self.assertEqual(norm(rooturi+"/tests/echo.cwl#main"),
                    norm(resolve_local(None, str(root / "tests" /
                        "echo.cwl")+"#main")))
        finally:
            os.chdir(origpath)
예제 #2
0
    def test_resolve_local(self):
        origpath = os.getcwd()
        os.chdir(os.path.join(get_data("")))

        def norm(uri):
            if onWindows():
                return uri.lower()
            else:
                return uri

        try:
            root = Path.cwd()
            rooturi = root.as_uri()
            self.assertEqual(
                norm(rooturi + "/tests/echo.cwl"),
                norm(resolve_local(None, os.path.join("tests", "echo.cwl"))))
            self.assertEqual(
                norm(rooturi + "/tests/echo.cwl#main"),
                norm(
                    resolve_local(None,
                                  os.path.join("tests", "echo.cwl") +
                                  "#main")))
            self.assertEqual(
                norm(rooturi + "/tests/echo.cwl"),
                norm(resolve_local(None, str(root / "tests" / "echo.cwl"))))
            self.assertEqual(
                norm(rooturi + "/tests/echo.cwl#main"),
                norm(
                    resolve_local(None,
                                  str(root / "tests" / "echo.cwl") + "#main")))
        finally:
            os.chdir(origpath)
예제 #3
0
파일: util.py 프로젝트: ltirrell/cwltool
def working_directory(path):
    """Changes working directory and returns to previous on exit."""
    prev_cwd = Path.cwd()
    # before python 3.6 chdir doesn't support paths from pathlib
    os.chdir(str(path))
    try:
        yield
    finally:
        os.chdir(str(prev_cwd))
예제 #4
0
파일: util.py 프로젝트: denis-yuen/cwltool
def working_directory(path):
    """Changes working directory and returns to previous on exit."""
    prev_cwd = Path.cwd()
    # before python 3.6 chdir doesn't support paths from pathlib
    os.chdir(str(path))
    try:
        yield
    finally:
        os.chdir(str(prev_cwd))