Skip to content

Commit

Permalink
🔬 add integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chfw committed Aug 15, 2019
1 parent 79ba26a commit 3092189
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 3 deletions.
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ python_version= '3.6'
fs = "*"
crayons = "*"
GitPython = "*"
git-url-parse = '>=1.2.2'

[dev-packages]
nose = "*"
Expand Down
1 change: 1 addition & 0 deletions gitfs2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ dependencies:
- fs
- crayons
- GitPython
- git-url-parse>=1.2.2
entry_points:
fs.opener:
- "git = gitfs2:GitFSOpener"
Expand Down
7 changes: 4 additions & 3 deletions gitfs2/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ def git_clone(require, action_required=True):
mkdir_p(app_home)

repo_name = get_repo_name(require.git_url)
local_repo_folder = os.path.join(app_home, repo_name)
local_repo_folder = fs.path.join(app_home, repo_name)

if action_required:
if os.path.exists(local_repo_folder):
try:
fs.open_fs(local_repo_folder)
reporter.info("Found repo in %s" % local_repo_folder)
repo = Repo(local_repo_folder)
repo.git.pull()
Expand All @@ -73,7 +74,7 @@ def git_clone(require, action_required=True):
if require.submodule:
reporter.info("updating submodule")
repo.git.submodule("update")
else:
except fs.errors.CreateFailed:
reporter.info("git clone %s" % require.git_url)
repo = Repo.clone_from(
require.git_url, local_repo_folder, **require.clone_params()
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
fs
crayons
GitPython
git-url-parse>=1.2.2
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"fs",
"crayons",
"GitPython",
"git-url-parse>=1.2.2",
]
SETUP_COMMANDS = {}

Expand Down
9 changes: 9 additions & 0 deletions tests/test_git_repo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import fs
from gitfs2.repo import git_clone, GitRequire


def test_clone_a_real_github():
git_url = "https://github.com/moremoban/hello"
require = GitRequire(git_url=git_url)
folder = git_clone(require)
fs.open_fs(folder)

0 comments on commit 3092189

Please sign in to comment.