store sample git repo as dot_git, then copy when testing
This commit is contained in:
parent
b223138ab2
commit
2da040547a
3 changed files with 16 additions and 1 deletions
1
tests/samples/projects/git/dot_git/HEAD
Normal file
1
tests/samples/projects/git/dot_git/HEAD
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ref: refs/heads/master
|
7
tests/samples/projects/git/dot_git/config
Normal file
7
tests/samples/projects/git/dot_git/config
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
[core]
|
||||||
|
repositoryformatversion = 0
|
||||||
|
filemode = true
|
||||||
|
bare = false
|
||||||
|
logallrefupdates = true
|
||||||
|
ignorecase = true
|
||||||
|
precomposeunicode = true
|
|
@ -5,6 +5,9 @@ from wakatime.main import execute
|
||||||
from wakatime.packages import requests
|
from wakatime.packages import requests
|
||||||
from wakatime.packages.requests.models import Response
|
from wakatime.packages.requests.models import Response
|
||||||
|
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import tempfile
|
||||||
import time
|
import time
|
||||||
from wakatime.compat import u
|
from wakatime.compat import u
|
||||||
from . import utils
|
from . import utils
|
||||||
|
@ -55,8 +58,12 @@ class LanguagesTestCase(utils.TestCase):
|
||||||
response.status_code = 0
|
response.status_code = 0
|
||||||
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
self.patched['wakatime.packages.requests.adapters.HTTPAdapter.send'].return_value = response
|
||||||
|
|
||||||
|
tempdir = tempfile.mkdtemp()
|
||||||
|
shutil.copytree('tests/samples/projects/git', os.path.join(tempdir, 'git'))
|
||||||
|
shutil.move(os.path.join(tempdir, 'git', 'dot_git'), os.path.join(tempdir, 'git', '.git'))
|
||||||
|
|
||||||
now = u(int(time.time()))
|
now = u(int(time.time()))
|
||||||
entity = 'tests/samples/projects/git/emptyfile.txt'
|
entity = os.path.join(tempdir, 'git', 'emptyfile.txt')
|
||||||
config = 'tests/samples/sample.cfg'
|
config = 'tests/samples/sample.cfg'
|
||||||
|
|
||||||
args = ['--file', entity, '--config', config, '--time', now]
|
args = ['--file', entity, '--config', config, '--time', now]
|
||||||
|
|
Loading…
Reference in a new issue