def test_matches_version_with_require_current_system_no_match(self): """Testing PackageRules.matches_version with require_current_system=True and no match """ bundle = PackageBundle(manifest_url='packages/TestPackage/index.json') channel = PackageChannel( bundle=bundle, name='1.0.x', created_timestamp=datetime(2015, 10, 11, 8, 17, 29, 958569), last_updated_timestamp=datetime(2015, 10, 12, 8, 17, 29, 958569)) channel._loaded = True rules = PackageRules(channel=channel, version_range='*', package_type='python', package_name='TestPackage', systems=['MyDistro>=2.3.4']) channel._package_rules = [rules] self.spy_on(platform.system, call_fake=lambda: 'Linux') self.spy_on(platform.dist, call_fake=lambda: ('MyDistro', '1.3', '')) self.assertFalse(rules.matches_version('1.0', require_current_system=True))
def test_matches_version_without_match(self): """Testing PackageRules.matches_version without match""" bundle = PackageBundle(manifest_url='packages/TestPackage/index.json') channel = PackageChannel( bundle=bundle, name='1.0.x', created_timestamp=datetime(2015, 10, 11, 8, 17, 29, 958569), last_updated_timestamp=datetime(2015, 10, 12, 8, 17, 29, 958569)) channel._loaded = True rules = PackageRules(channel=channel, version_range='>=2.0', package_type='python', package_name='TestPackage', systems=['*']) channel._package_rules = [rules] self.assertFalse(rules.matches_version('1.0', require_current_system=False))