summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonny Pfannschmidt <opensource@ronnypfannschmidt.de>2015-11-28 17:50:28 +0100
committerRonny Pfannschmidt <opensource@ronnypfannschmidt.de>2015-11-28 17:50:28 +0100
commitb977fe0ca634c02ef2602b1d1d05955afab4c08d (patch)
tree6a632c1c9c439ab22a609bfe43b14656706f943a
parent937a308054645890f9092050a5e001fccf693ed9 (diff)
downloadsetuptools-scm-b977fe0ca634c02ef2602b1d1d05955afab4c08d.tar.gz
extract git tests
-rw-r--r--testing/test_git.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/testing/test_git.py b/testing/test_git.py
new file mode 100644
index 0000000..2fe9aad
--- /dev/null
+++ b/testing/test_git.py
@@ -0,0 +1,34 @@
+from setuptools_scm import integration
+
+
+def test_version_from_git(wd):
+ wd('git init')
+ wd('git config user.email test@example.com')
+ wd('git config user.name "a test"')
+ assert wd.version == '0.0'
+ wd.write('test.txt', 'test')
+ wd('git add test.txt')
+ wd('git commit -m commit')
+
+ assert wd.version.startswith('0.1.dev1+')
+ assert not wd.version.endswith('1-')
+
+ wd('git tag v0.1')
+ assert wd.version == '0.1'
+
+ wd.write('test.txt', 'test2')
+ assert wd.version.startswith('0.2.dev0+')
+ wd('git add test.txt')
+ wd('git commit -m commit')
+ assert wd.version.startswith('0.2.dev1+')
+ wd('git tag version-0.2')
+ assert wd.version.startswith('0.2')
+
+
+def test_find_files_stop_at_root_git(wd):
+ wd('git init')
+ wd.write('test.txt', 'test')
+ wd('git add .')
+ wd('git commit -m test -u test')
+ wd.cwd.ensure('project/setup.cfg')
+ assert integration.find_files(str(wd.cwd/'project')) == []