|
16 | 16 | except ImportError:
|
17 | 17 | from unittest2 import skipIf, SkipTest
|
18 | 18 |
|
| 19 | +try: |
| 20 | + import pathlib |
| 21 | +except ImportError: |
| 22 | + pathlib = None |
| 23 | + |
19 | 24 | from git import (
|
20 | 25 | InvalidGitRepositoryError,
|
21 | 26 | Repo,
|
@@ -210,6 +215,15 @@ def test_clone_from_keeps_env(self, rw_dir):
|
210 | 215 |
|
211 | 216 | assert_equal(environment, cloned.git.environment())
|
212 | 217 |
|
| 218 | + @with_rw_directory |
| 219 | + def test_clone_from_pathlib(self, rw_dir): |
| 220 | + if pathlib is None: # pythons bellow 3.4 don't have pathlib |
| 221 | + raise SkipTest("pathlib was introduced in 3.4") |
| 222 | + |
| 223 | + original_repo = Repo.init(osp.join(rw_dir, "repo")) |
| 224 | + |
| 225 | + Repo.clone_from(original_repo.git_dir, pathlib.Path(rw_dir) / "clone_pathlib") |
| 226 | + |
213 | 227 | def test_init(self):
|
214 | 228 | prev_cwd = os.getcwd()
|
215 | 229 | os.chdir(tempfile.gettempdir())
|
|
0 commit comments