def test_only_if_needed_does_upgrade_deps_when_no_longer_satisfied(script):
 script.pip_install_local('simple==1.0', expect_error=True)
 result = script.pip_install_local('--upgrade', '--upgrade-strategy=only-if-needed', 'require_simple', expect_error=True)
 assert (((script.site_packages / 'require_simple-1.0-py%s.egg-info') % pyversion) not in result.files_deleted), 'should have installed require_simple==1.0'
 assert (((script.site_packages / 'simple-3.0-py%s.egg-info') % pyversion) in result.files_created), 'should have installed simple==3.0'
 assert (((script.site_packages / 'simple-1.0-py%s.egg-info') % pyversion) in result.files_deleted), 'should have uninstalled simple==1.0'

def test_only_if_needed_does_upgrade_deps_when_no_longer_satisfied ( script ) : script . pip_install_local ( 'simple==1.0' , expect_error = True ) result = script . pip_install_local ( '--upgrade' , '--upgrade-strategy=only-if-needed' , 'require_simple' , expect_error = True ) assert ( ( ( script . site_packages / 'require_simple-1.0-py%s.egg-info' ) % pyversion ) not in result . files_deleted ) , 'should have installed require_simple==1.0' assert ( ( ( script . site_packages / 'simple-3.0-py%s.egg-info' ) % pyversion ) in result . files_created ) , 'should have installed simple==3.0' assert ( ( ( script . site_packages / 'simple-1.0-py%s.egg-info' ) % pyversion ) in result . files_deleted ) , 'should have uninstalled simple==1.0'
it does upgrade a dependency if it no longer satisfies the requirements .