Example #1
0
    def test_requirements(self):
        old = upt.Package('foo', '1.0')
        old.requirements = {
            'run': [
                upt.PackageRequirement('bar'),
            ]
        }
        new = upt.Package('foo', '1.0')
        new.requirements = {
            'run': [
                upt.PackageRequirement('baz'),
            ]
        }
        pdiff = umu.UptDiff(old, new)

        self.assertEqual(pdiff.new_requirements,
                         [upt.PackageRequirement('baz')])
        self.assertEqual(pdiff.deleted_requirements,
                         [upt.PackageRequirement('bar')])
Example #2
0
 def test_upgrade_depends(self):
     old = upt.Package('foo', '1.0')
     old.requirements = {
         'run': [
             upt.PackageRequirement('bar'),
         ]
     }
     new = upt.Package('foo', '1.1')
     new.requirements = {
         'run': [
             upt.PackageRequirement('baz'),
         ]
     }
     pdiff = umu.UptDiff(old, new)
     old_depends = [
         'port:py${python.version}-bar',
     ]
     new_depends = umu._upgrade_depends(old_depends, pdiff)
     expected = [
         'port:py${python.version}-baz',
     ]
     self.assertEqual(new_depends, expected)
    def test_needs_requirement(self, mock_need_req):
        specifiers = {
            '>=42': '>=42',
            '<=42': '<=42',
            '!=42': '!=42',
            '==42': '==42',
            '>= 1.2, != 1.5, < 2.0': '>=1.200.0, !=1.500.0, <2.0.0',
            '>= 1.2, != 2, < 3.0': '>=1.200.0, !=2, <3.0.0'
        }

        for key, value in specifiers.items():
            req = upt.PackageRequirement('bar', key)
            self.macports_backend.needs_requirement(req, 'fake-phase')
            self.assertCountEqual(
                mock_need_req.call_args[0][0].specifier.split(', '),
                value.split(', '))
 def test_jinja2_reqformat(self):
     req = upt.PackageRequirement('Require')
     self.assertEqual(self.package.jinja2_reqformat(req),
                      'rb${ruby.suffix}-require')
 def test_jinja2_reqformat(self):
     req = upt.PackageRequirement('Require')
     self.assertEqual(self.package.jinja2_reqformat(req),
                      'py${python.version}-require')
Example #6
0
 def test_jinja2_reqformat(self):
     req = upt.PackageRequirement('Require')
     self.assertEqual(self.package.jinja2_reqformat(req),
                      'p${perl5.major}-require')