| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9807dd4 commit 7f08b77
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,6 +36,11 @@ | |||
| 36 | 36 | import gc | |
| 37 | 37 | import gitdb | |
| 38 | 38 | ||
| 39 | + try: | ||
| 40 | + import pathlib | ||
| 41 | + except ImportError: | ||
| 42 | + pathlib = None | ||
| 43 | + | ||
| 39 | 44 | ||
| 40 | 45 | log = logging.getLogger(__name__) | |
| 41 | 46 | ||
@@ -116,6 +121,8 @@ def __init__(self, path=None, odbt=GitCmdObjectDB, search_parent_directories=Fal | |||
| 116 | 121 | epath = decygpath(epath) | |
| 117 | 122 | ||
| 118 | 123 | epath = epath or path or os.getcwd() | |
| 124 | + if not isinstance(epath, str): | ||
| 125 | + epath = str(epath) | ||
| 119 | 126 | if expand_vars and ("%" in epath or "$" in epath): | |
| 120 | 127 | warnings.warn("The use of environment variables in paths is deprecated" + | |
| 121 | 128 | "\nfor security reasons and may be removed in the future!!") | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -110,6 +110,14 @@ def test_repo_creation_from_different_paths(self, rw_repo): | |||
| 110 | 110 | assert not rw_repo.git.working_dir.endswith('.git') | |
| 111 | 111 | self.assertEqual(r_from_gitdir.git.working_dir, rw_repo.git.working_dir) | |
| 112 | 112 | ||
| 113 | + @with_rw_repo('0.3.2.1') | ||
| 114 | + def test_repo_creation_pathlib(self, rw_repo): | ||
| 115 | + if pathlib is None: # pythons bellow 3.4 don't have pathlib | ||
| 116 | + raise SkipTest("pathlib was introduced in 3.4") | ||
| 117 | + | ||
| 118 | + r_from_gitdir = Repo(pathlib.Path(rw_repo.git_dir)) | ||
| 119 | + self.assertEqual(r_from_gitdir.git_dir, rw_repo.git_dir) | ||
| 120 | + | ||
| 113 | 121 | def test_description(self): | |
| 114 | 122 | txt = "Test repository" | |
| 115 | 123 | self.rorepo.description = txt | |
| Back | FazBrowse Home | New Git URL |
0 commit comments