-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/inab/WfExS-backend
- Loading branch information
Showing
13 changed files
with
332 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[pytest] | ||
testpaths = tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Tests for WfExS-backend""" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
import pytest | ||
import logging | ||
from typing import ( | ||
cast, | ||
TYPE_CHECKING, | ||
) | ||
|
||
if TYPE_CHECKING: | ||
from wfexs_backend.common import ( | ||
RelPath, | ||
RepoTag, | ||
RepoURL, | ||
URIType, | ||
) | ||
|
||
from wfexs_backend.common import ( | ||
RepoGuessFlavor, | ||
RemoteRepo, | ||
RepoType, | ||
) | ||
from wfexs_backend.fetchers.git import guess_git_repo_params | ||
|
||
|
||
@pytest.mark.parametrize( | ||
["url", "expected"], | ||
[ | ||
( | ||
"https://github.com/inab/WfExS-backend.git", | ||
RemoteRepo( | ||
repo_url=cast("RepoURL", "https://github.com/inab/WfExS-backend.git"), | ||
tag=cast("RepoTag", "main"), | ||
guess_flavor=RepoGuessFlavor.GitHub, | ||
repo_type=RepoType.Git, | ||
), | ||
), | ||
( | ||
"git+https://github.com/inab/WfExS-backend.git", | ||
RemoteRepo( | ||
repo_url=cast("RepoURL", "https://github.com/inab/WfExS-backend.git"), | ||
tag=cast("RepoTag", "main"), | ||
repo_type=RepoType.Git, | ||
), | ||
), | ||
( | ||
"https://github.com/inab/WfExS-backend.git@0.1.2", | ||
RemoteRepo( | ||
repo_url=cast("RepoURL", "https://github.com/inab/WfExS-backend.git"), | ||
repo_type=RepoType.Git, | ||
tag=cast("RepoTag", "0.1.2"), | ||
), | ||
), | ||
( | ||
"https://github.com/inab/WfExS-backend.git#subdirectory=workflow_examples/ipc/cosifer_test1_cwl.wfex.stage", | ||
RemoteRepo( | ||
repo_url=cast("RepoURL", "https://github.com/inab/WfExS-backend.git"), | ||
repo_type=RepoType.Git, | ||
tag=cast("RepoTag", "main"), | ||
rel_path=cast( | ||
"RelPath", "workflow_examples/ipc/cosifer_test1_cwl.wfex.stage" | ||
), | ||
), | ||
), | ||
( | ||
"ssh://git@github.com:inab/WfExS-backend.git", | ||
RemoteRepo( | ||
repo_url=cast("RepoURL", "ssh://git@github.com/inab/WfExS-backend.git"), | ||
tag=cast("RepoTag", "main"), | ||
repo_type=RepoType.Git, | ||
), | ||
), | ||
( | ||
"git+ssh://git@github.com:inab/WfExS-backend.git", | ||
RemoteRepo( | ||
repo_url=cast("RepoURL", "ssh://git@github.com/inab/WfExS-backend.git"), | ||
tag=cast("RepoTag", "main"), | ||
repo_type=RepoType.Git, | ||
), | ||
), | ||
( | ||
"ssh://git@github.com:inab/WfExS-backend.git@0.1.2", | ||
RemoteRepo( | ||
repo_url=cast("RepoURL", "ssh://git@github.com/inab/WfExS-backend.git"), | ||
repo_type=RepoType.Git, | ||
tag=cast("RepoTag", "0.1.2"), | ||
), | ||
), | ||
( | ||
"ssh://git@github.com:inab/WfExS-backend.git#subdirectory=workflow_examples/ipc/cosifer_test1_cwl.wfex.stage", | ||
RemoteRepo( | ||
repo_url=cast("RepoURL", "ssh://git@github.com/inab/WfExS-backend.git"), | ||
repo_type=RepoType.Git, | ||
tag=cast("RepoTag", "main"), | ||
rel_path=cast( | ||
"RelPath", "workflow_examples/ipc/cosifer_test1_cwl.wfex.stage" | ||
), | ||
), | ||
), | ||
( | ||
"file:///inab/WfExS-backend/.git", | ||
RemoteRepo( | ||
repo_url=cast("RepoURL", "file:///inab/WfExS-backend/.git"), | ||
repo_type=RepoType.Git, | ||
), | ||
), | ||
( | ||
"git+file:///inab/WfExS-backend/.git", | ||
RemoteRepo( | ||
repo_url=cast("RepoURL", "file:///inab/WfExS-backend/.git"), | ||
repo_type=RepoType.Git, | ||
), | ||
), | ||
( | ||
"file:///inab/WfExS-backend/.git@0.1.2", | ||
RemoteRepo( | ||
repo_url=cast("RepoURL", "file:///inab/WfExS-backend/.git"), | ||
repo_type=RepoType.Git, | ||
tag=cast("RepoTag", "0.1.2"), | ||
), | ||
), | ||
( | ||
"file:///inab/WfExS-backend/.git#subdirectory=workflow_examples/ipc/cosifer_test1_cwl.wfex.stage", | ||
RemoteRepo( | ||
repo_url=cast("RepoURL", "file:///inab/WfExS-backend/.git"), | ||
repo_type=RepoType.Git, | ||
rel_path=cast( | ||
"RelPath", "workflow_examples/ipc/cosifer_test1_cwl.wfex.stage" | ||
), | ||
), | ||
), | ||
( | ||
"github.com/inab/WfExS-backend.git", | ||
None, | ||
), | ||
( | ||
"git@github.com:inab/WfExS-backend.git", | ||
RemoteRepo( | ||
repo_url=cast("RepoURL", "ssh://git@github.com/inab/WfExS-backend.git"), | ||
tag=cast("RepoTag", "main"), | ||
repo_type=RepoType.Git, | ||
), | ||
), | ||
( | ||
"ssh://git@github.com:inab/WfExS-backend", | ||
RemoteRepo( | ||
repo_url=cast("RepoURL", "ssh://git@github.com/inab/WfExS-backend"), | ||
tag=cast("RepoTag", "main"), | ||
repo_type=RepoType.Git, | ||
), | ||
), | ||
( | ||
"https://github.com/inab/WfExS-backend", | ||
RemoteRepo( | ||
repo_url=cast("RepoURL", "https://github.com/inab/WfExS-backend"), | ||
guess_flavor=RepoGuessFlavor.GitHub, | ||
repo_type=RepoType.Git, | ||
tag=cast("RepoTag", "main"), | ||
), | ||
), | ||
( | ||
"file:///inab/WfExS-backend", | ||
RemoteRepo( | ||
repo_url=cast("RepoURL", "file:///inab/WfExS-backend"), | ||
repo_type=RepoType.Git, | ||
), | ||
), | ||
], | ||
) | ||
def test_guess_git_repo_params(url: "str", expected: "RemoteRepo") -> "None": | ||
logger = logging.Logger("name") | ||
output = guess_git_repo_params(cast("URIType", url), logger=logger) | ||
assert output == expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.