blob: c3ae002dbfe8ab7c5e99a8a264a0365740ba6ca1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
from setuptools_scm import integration
import pytest
from datetime import date
@pytest.fixture
def wd(wd):
wd('git init')
wd('git config user.email test@example.com')
wd('git config user.name "a test"')
wd.add_command = 'git add .'
wd.commit_command = 'git commit -m test-{reason}'
return wd
def test_version_from_git(wd):
assert wd.version == '0.0'
wd.commit_testfile()
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.commit_testfile()
assert wd.version.startswith('0.2.dev1+')
wd('git tag version-0.2')
assert wd.version.startswith('0.2')
@pytest.mark.issue(108)
def test_git_worktree(wd):
wd.write('test.txt', 'test2')
assert wd.version.startswith('0.1.dev0+d')
@pytest.mark.issue(86)
def test_git_dirty_notag(wd):
wd.commit_testfile()
wd.write('test.txt', 'test2')
wd("git add test.txt")
assert wd.version.startswith('0.1.dev1')
today = date.today()
# we are dirty, check for the tag
assert today.strftime('.d%Y%m%d') in wd.version
def test_find_files_stop_at_root_git(wd):
wd.commit_testfile()
wd.cwd.ensure('project/setup.cfg')
assert integration.find_files(str(wd.cwd/'project')) == []
def test_alphanumeric_tags_match(wd):
wd.commit_testfile()
wd('git tag newstyle-development-started')
assert wd.version.startswith('0.1.dev1+')
|