Add testcases for VCS source

This commit is contained in:
Felix Yan 2015-11-05 20:59:07 +08:00
parent 5bde44a3c2
commit ce9819f49d
2 changed files with 19 additions and 1 deletions

View File

@ -27,7 +27,7 @@ def _parse_oldver(oldver):
def get_version(name, conf, callback):
vcs = conf['vcs']
oldver = conf['oldver']
oldver = conf.get('oldver')
cmd = _cmd_prefix + [name, vcs]
p = tornado.process.Subprocess(cmd, io_loop=IOLoop.instance(),
stdout=tornado.process.Subprocess.STREAM)

18
tests/test_vcs.py Normal file
View File

@ -0,0 +1,18 @@
import os
import shutil
import pytest
from tests.helper import ExternalVersionTestCase
class VCSTest(ExternalVersionTestCase):
@pytest.mark.skipif(shutil.which("git") is None,
reason="requires git command")
def test_git(self):
os.path.exists("example") or os.mkdir("example")
self.assertEqual(self.sync_get_version("example", {"vcs": "git+https://github.com/harry-sanabria/ReleaseTestRepo.git"}), "1.1.2b3cdf6134b07ae6ac77f11b586dc1ae6d1521db")
@pytest.mark.skipif(shutil.which("hg") is None,
reason="requires hg command")
def test_mercurial(self):
os.path.exists("example") or os.mkdir("example")
self.assertEqual(self.sync_get_version("example", {"vcs": "hg+https://bitbucket.org/pil0t/testrepo"}), "1.1.84679e29c7d9")