Add failing test to check that no warning gets logged.
@@ -6,23 +6,44 @@ from tests.lib import (
from tests.lib.local_repos import local_checkout
-def _install_version_pkg(script, path):
+def _install_version_pkg(script, path, rev=None):
"""
Install the version_pkg package, and return the version installed.
Args:
path: a tests.lib.path.Path object pointing to a Git repository
containing the package.
+ rev: an optional revision to install like a branch name or tag.
"""
- abs_path = path.abspath.replace('\\', '/')
- project_url = 'git+file://{}@master#egg=version_pkg'.format(abs_path)
- script.pip('install', '-e', project_url)
+ path = path.abspath.replace('\\', '/')
+ revision = '' if rev is None else '@{}'.format(rev)
+ url = 'git+file://{}{}#egg=version_pkg'.format(path, revision)
+ script.pip('install', '-e', url)
result = script.run('version_pkg')
version = result.stdout.strip()
return version
+@pytest.mark.network
+def test_git_install_again_after_changes(script):
+ """
+ Test installing a repository a second time without specifying a revision,
+ and after updates to the remote repository.
+
+ This test also checks that no warning message like the following gets
+ logged on the update: "Did not find branch or tag ..., assuming ref or
+ revision."
+ """
+ version_pkg_path = _create_test_package(script)
+ version = _install_version_pkg(script, version_pkg_path)
+ assert version == '0.1'
+
+ _change_test_package_version(script, version_pkg_path)
+ version = _install_version_pkg(script, version_pkg_path)
+ assert version == 'some different version'
+
+
@pytest.mark.network
def test_git_install_branch_again_after_branch_changes(script):
"""
@@ -30,11 +51,11 @@ def test_git_install_branch_again_after_branch_changes(script):
repository.
"""
version_pkg_path = _create_test_package(script)
- version = _install_version_pkg(script, version_pkg_path)
+ version = _install_version_pkg(script, version_pkg_path, rev='master')
assert version == '0.1'
_change_test_package_version(script, version_pkg_path)
- version = _install_version_pkg(script, version_pkg_path)
+ version = _install_version_pkg(script, version_pkg_path, rev='master')
assert version == 'some different version'
