本文整理汇总了Python中vcversioner.find_version函数的典型用法代码示例。如果您正苦于以下问题:Python find_version函数的具体用法?Python find_version怎么用?Python find_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了find_version函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_custom_git_args
def test_custom_git_args(tmpdir):
"The command to execute to get the version can be customized."
tmpdir.chdir()
popen = RaisingFakePopen()
with pytest.raises(SystemExit):
vcversioner.find_version(Popen=popen, git_args=('foo', 'bar'))
assert popen.args[0] == ['foo', 'bar']
开发者ID:andrewshadura,项目名称:vcversioner,代码行数:7,代码来源:test_vcversioner.py
示例2: test_invalid_version_file
def test_invalid_version_file(gitdir):
"Invalid output in version.txt is similarly a failure."
with gitdir.join('version.txt').open('w') as outfile:
outfile.write('foob')
with pytest.raises(SystemExit) as excinfo:
vcversioner.find_version(Popen=empty)
assert excinfo.value.args[0] == 2
开发者ID:EdwardBetts,项目名称:vcversioner,代码行数:7,代码来源:test_vcversioner.py
示例3: test_version_file_path_translation
def test_version_file_path_translation(gitdir, monkeypatch):
"/ is translated into the correct path separator for version.txt."
monkeypatch.setattr(os, 'sep', ':')
open = FakeOpen()
with pytest.raises(OSError):
vcversioner.find_version(Popen=basic_version, open=open, version_file='spam/eggs', vcs_args=[])
assert open.args[0] == 'spam:eggs'
开发者ID:EdwardBetts,项目名称:vcversioner,代码行数:7,代码来源:test_vcversioner.py
示例4: test_git_arg_path_translation
def test_git_arg_path_translation(gitdir, monkeypatch):
"/ is translated into the correct path separator in git arguments."
monkeypatch.setattr(os, 'sep', ':')
popen = RaisingFakePopen()
with pytest.raises(SystemExit):
vcversioner.find_version(Popen=popen, vcs_args=['spam/eggs'], version_file=None)
assert popen.args[0] == ['spam:eggs']
开发者ID:EdwardBetts,项目名称:vcversioner,代码行数:7,代码来源:test_vcversioner.py
示例5: test_custom_vcs_args_substitutions_with_different_root
def test_custom_vcs_args_substitutions_with_different_root(tmpdir):
"Specifying a different root will cause that root to be substituted."
tmpdir.chdir()
popen = RaisingFakePopen()
with pytest.raises(SystemExit):
vcversioner.find_version(Popen=popen, root='/spam', vcs_args=('%(root)s',))
assert popen.args[0] == ['/spam']
开发者ID:EdwardBetts,项目名称:vcversioner,代码行数:7,代码来源:test_vcversioner.py
示例6: test_custom_git_args_substitutions
def test_custom_git_args_substitutions(tmpdir):
"The command arguments have some substitutions performed."
tmpdir.chdir()
popen = RaisingFakePopen()
with pytest.raises(SystemExit):
vcversioner.find_version(Popen=popen, git_args=('foo', 'bar', '%(pwd)s', '%(root)s'))
assert popen.args[0] == ['foo', 'bar', tmpdir.strpath, tmpdir.strpath]
开发者ID:andrewshadura,项目名称:vcversioner,代码行数:7,代码来源:test_vcversioner.py
示例7: test_invalid_git
def test_invalid_git(tmpdir):
"Invalid output from git is a failure too."
tmpdir.chdir()
with pytest.raises(SystemExit) as excinfo:
vcversioner.find_version(Popen=invalid)
assert excinfo.value.args[0] == 2
assert not tmpdir.join('version.txt').check()
开发者ID:andrewshadura,项目名称:vcversioner,代码行数:7,代码来源:test_vcversioner.py
示例8: test_no_git
def test_no_git(tmpdir):
"If git fails and there's no version.txt, abort."
tmpdir.chdir()
with pytest.raises(SystemExit) as excinfo:
vcversioner.find_version(Popen=empty)
assert excinfo.value.args[0] == 2
assert not tmpdir.join('version.txt').check()
开发者ID:andrewshadura,项目名称:vcversioner,代码行数:7,代码来源:test_vcversioner.py
示例9: test_version_file_disabled_Popen_raises
def test_version_file_disabled_Popen_raises(tmpdir):
"If version.txt is disabled and git fails to spawn, abort as well."
tmpdir.chdir()
with pytest.raises(SystemExit) as excinfo:
vcversioner.find_version(Popen=RaisingFakePopen(), version_file=None)
assert excinfo.value.args[0] == 2
assert not tmpdir.join('version.txt').check()
开发者ID:andrewshadura,项目名称:vcversioner,代码行数:7,代码来源:test_vcversioner.py
示例10: test_no_output_on_version_file_success
def test_no_output_on_version_file_success(gitdir, capsys):
"There is no output if everything succeeded, even if the version was read from a version file."
gitdir.join('version.txt').write('1.0-0-gbeef')
vcversioner.find_version(Popen=git_failed)
out, err = capsys.readouterr()
assert not out
assert not err
开发者ID:EdwardBetts,项目名称:vcversioner,代码行数:7,代码来源:test_vcversioner.py
示例11: test_when_Popen_raises
def test_when_Popen_raises(tmpdir):
"If *spawning* git fails and there's no version.txt, abort."
tmpdir.chdir()
with pytest.raises(SystemExit) as excinfo:
vcversioner.find_version(Popen=RaisingFakePopen())
assert excinfo.value.args[0] == 2
assert not tmpdir.join('version.txt').check()
开发者ID:andrewshadura,项目名称:vcversioner,代码行数:7,代码来源:test_vcversioner.py
示例12: test_version_file_disabled_git_failed
def test_version_file_disabled_git_failed(tmpdir):
"If version.txt is disabled and git fails, nothing can be done."
tmpdir.chdir()
with pytest.raises(SystemExit) as excinfo:
vcversioner.find_version(Popen=empty, version_file=None)
assert excinfo.value.args[0] == 2
assert not tmpdir.join('version.txt').check()
开发者ID:andrewshadura,项目名称:vcversioner,代码行数:7,代码来源:test_vcversioner.py
示例13: test_hg_detection
def test_hg_detection(hgdir):
".hg directories get detected and the appropriate hg command gets run."
popen = RaisingFakePopen()
with pytest.raises(SystemExit):
vcversioner.find_version(Popen=popen)
assert popen.args[0] == [
'hg', 'log', '-R', hgdir.strpath, '-r', '.', '--template',
'{latesttag}-{latesttagdistance}-hg{node|short}']
开发者ID:EdwardBetts,项目名称:vcversioner,代码行数:8,代码来源:test_vcversioner.py
示例14: test_no_git_output_on_version_unparsable
def test_no_git_output_on_version_unparsable(capsys):
"The output from git is not shown if git succeeded but the version couldn't be parsed."
with pytest.raises(SystemExit):
vcversioner.find_version(Popen=invalid, version_file='version.txt', vcs_args=[])
out, err = capsys.readouterr()
assert not err
assert out == (
"vcversioner: %r (from VCS) couldn't be parsed into a version.\n" % ('foob',))
开发者ID:EdwardBetts,项目名称:vcversioner,代码行数:8,代码来源:test_vcversioner.py
示例15: test_version_module_paths
def test_version_module_paths(gitdir):
"Version modules can be written out too."
paths = ['foo.py', 'bar.py']
vcversioner.find_version(
Popen=basic_version, version_module_paths=paths)
for path in paths:
with open(path) as infile:
assert infile.read() == """
开发者ID:EdwardBetts,项目名称:vcversioner,代码行数:8,代码来源:test_vcversioner.py
示例16: test_no_vcs_no_version_file
def test_no_vcs_no_version_file(tmpdir, capsys):
"If no VCS is detected with no version_file, vcversioner aborts."
tmpdir.chdir()
with pytest.raises(SystemExit):
vcversioner.find_version(version_file=None, Popen=basic_version)
out, err = capsys.readouterr()
assert not err
assert out == (
'vcversioner: no VCS could be detected in %r.\n' % (unicode(tmpdir.strpath),))
开发者ID:EdwardBetts,项目名称:vcversioner,代码行数:9,代码来源:test_vcversioner.py
示例17: test_git_output_on_no_version_file
def test_git_output_on_no_version_file(gitdir, capsys):
"The output from git is shown if it failed and the version file is disabled."
with pytest.raises(SystemExit):
vcversioner.find_version(Popen=git_failed, version_file=None, vcs_args=[])
out, err = capsys.readouterr()
assert not err
assert out == (
'vcversioner: [] failed.\n'
'vcversioner: -- VCS output follows --\n'
'vcversioner: fatal: whatever\n')
开发者ID:EdwardBetts,项目名称:vcversioner,代码行数:10,代码来源:test_vcversioner.py
示例18: test_git_output_on_version_unparsable
def test_git_output_on_version_unparsable(gitdir, capsys):
"The output from git is shown if it failed and the version couldn't be parsed."
gitdir.join('version.txt').write('doof')
with pytest.raises(SystemExit):
vcversioner.find_version(Popen=git_failed, version_file='version.txt', vcs_args=[])
out, err = capsys.readouterr()
assert not err
assert out == (
"vcversioner: %r (from %r) couldn't be parsed into a version.\n"
'vcversioner: -- VCS output follows --\n'
'vcversioner: fatal: whatever\n' % ('doof', 'version.txt'))
开发者ID:EdwardBetts,项目名称:vcversioner,代码行数:11,代码来源:test_vcversioner.py
示例19: test_git_output_on_version_file_absent
def test_git_output_on_version_file_absent(gitdir, capsys):
"The output from git is shown if it failed and the version file doesn't exist."
with pytest.raises(SystemExit):
vcversioner.find_version(Popen=git_failed, version_file='version.txt', vcs_args=[])
out, err = capsys.readouterr()
assert not err
assert out == (
"vcversioner: [] failed and %r isn't present.\n"
'vcversioner: are you installing from a github tarball?\n'
'vcversioner: -- VCS output follows --\n'
'vcversioner: fatal: whatever\n' % ('version.txt',))
开发者ID:EdwardBetts,项目名称:vcversioner,代码行数:11,代码来源:test_vcversioner.py
示例20: test_no_vcs_absent_version_file
def test_no_vcs_absent_version_file(tmpdir, capsys):
"If no VCS is detected with an absent version_file, vcversioner aborts."
tmpdir.chdir()
with pytest.raises(SystemExit):
vcversioner.find_version(version_file='version.txt', Popen=basic_version)
out, err = capsys.readouterr()
assert not err
assert out == (
"vcversioner: no VCS could be detected in %r and %r isn't present.\n"
"vcversioner: are you installing from a github tarball?\n" % (
unicode(tmpdir.strpath), 'version.txt'))
开发者ID:EdwardBetts,项目名称:vcversioner,代码行数:11,代码来源:test_vcversioner.py
注:本文中的vcversioner.find_version函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论