-
Notifications
You must be signed in to change notification settings - Fork 1
/
tests.py
43 lines (30 loc) · 973 Bytes
/
tests.py
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
'''Tests for gitversion.'''
# pylint: disable=C0103
# pylint: disable=R0904
import contextlib
import versionfromgit
import os
import shutil
import tempfile
import unittest
import logging
LOGGER = logging.getLogger(__name__)
class GitVersionCase(unittest.TestCase):
'''Test the correct versions are detected (and written, if applicable).'''
repos = {
'repo1': {'versionstring': '0.1'},
}
def setUp(self):
self.tempdir = tempfile.mkdtemp()
LOGGER.debug("Created temporary directory %r", self.tempdir)
self.testdir = os.path.join(self.tempdir, 'repo')
self.gitdir = os.path.join(self.testdir, '.git')
def tearDown(self):
LOGGER.debug('Removing %r', self.tempdir)
shutil.rmtree(self.tempdir)
def test_git_describe(self):
'''
Tests that the version is determined correctly.
'''
for repo in self.repos:
LOGGER.debug('investigating %r', repo)