diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:26:28 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:26:28 +0000 |
commit | bbbeb2d07d4f7fd0191032c219b40565fd83454f (patch) | |
tree | 3c08f1e09ed89a004867762ab40f3b610f6c0fa1 /tests/test_vcs.py | |
parent | Initial commit. (diff) | |
download | flit-upstream/3.8.0.tar.xz flit-upstream/3.8.0.zip |
Adding upstream version 3.8.0.upstream/3.8.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_vcs.py')
-rw-r--r-- | tests/test_vcs.py | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/test_vcs.py b/tests/test_vcs.py new file mode 100644 index 0000000..4ed5ac3 --- /dev/null +++ b/tests/test_vcs.py @@ -0,0 +1,27 @@ +from contextlib import contextmanager +import os +from pathlib import Path +from tempfile import TemporaryDirectory + +from flit import vcs + +@contextmanager +def cwd(path): + if isinstance(path, Path): + path = str(path) + old_wd = os.getcwd() + os.chdir(path) + try: + yield + finally: + os.chdir(old_wd) + +def test_identify_git_parent(): + with TemporaryDirectory() as td: + td = Path(td) + (td / '.git').mkdir() + subdir = (td / 'subdir') + subdir.mkdir() + with cwd(subdir): + assert vcs.identify_vcs(Path('.')).name == 'git' + |