Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_should_return_revision_when_get_git_hash_succeeds(self):
self.execute_command.side_effect = [(0, "", ""), # is git
(0, "451", "any-stderr")]
self.assertEqual("451", VCSRevision().get_git_hash())
def test_should_return_revision_without_switched_when_svnversion_succeeds(self):
self.execute_command.return_value = 0, "451S", "any-stderr"
self.assertEqual("451", VCSRevision().get_svn_revision_count())
def test_should_not_detect_svn_when_status_fails(self):
self.execute_command.return_value = 1, "", ""
self.assertFalse(VCSRevision().is_a_svn_repo())
def test_should_detect_svn_when_status_succeeds(self):
self.execute_command.return_value = 0, "", ""
self.assertTrue(VCSRevision().is_a_svn_repo())
def test_should_raise_when_revparse_fails_in_get_git_hash(self):
self.execute_command.side_effect = [(0, "", ""), # is git
(1, "", "")]
self.assertRaises(PyBuilderException, VCSRevision().get_git_hash)
def test_should_raise_when_svnversion_fails(self):
self.execute_command.return_value = 1, "any-stdout", "any-stderr"
self.assertRaises(PyBuilderException, VCSRevision().get_svn_revision_count)
def test_should_return_revision_without_sparse_partial_when_svnversion_succeeds(self):
self.execute_command.return_value = 0, "451P", "any-stderr"
self.assertEqual("451", VCSRevision().get_svn_revision_count())
def test_should_return_revision_without_mixed_when_svnversion_succeeds(self):
self.execute_command.return_value = 0, "451:321", "any-stderr"
self.assertEqual("451", VCSRevision().get_svn_revision_count())
def set_properties_for_teamcity_builds(project):
import os
project.version = '%s.%s-%s' % (
project.version, VCSRevision().get_git_revision_count(), os.environ.get('BUILD_NUMBER', 0))
project.default_task = ['install_build_dependencies', 'publish']
project.set_property(
'install_dependencies_index_url', os.environ.get('PYPIPROXY_URL'))
project.set_property('install_dependencies_use_mirrors', False)
project.set_property('teamcity_output', True)
# -*- coding: utf-8 -*-
from pybuilder.core import use_plugin, init, Author
from pybuilder.vcs import VCSRevision
use_plugin("python.core")
use_plugin("python.unittest")
use_plugin("python.install_dependencies")
use_plugin("python.flake8")
#use_plugin("python.coverage")
use_plugin("python.distutils")
use_plugin('python.cram')
name = "snakepit"
default_task = "publish"
version = VCSRevision().get_git_revision_count()
summary = "Package Python software as an RPM including all dependencies " \
"(even the interpreter)."
authors = [Author('Valentin Haenel', 'valentin@haenel.co')]
license = 'Apache'
url = 'https://github.com/ImmobilienScout24/snakepit'
@init
def set_properties(project):
project.set_property('install_dependencies_upgrade', True)
project.build_depends_on("unittest2")
project.build_depends_on("requests_mock")
project.depends_on("jinja2")
project.depends_on("pyyaml")
project.depends_on("docopt")
project.depends_on("requests")