Ejemplo n.º 1
0
 def test_new_item_mismatches_global_list_with_extra(self):
     # If the global list has multiple entries for an item with
     # different "extra" specifiers, the values must all be in the
     # requirements file.
     r_content = textwrap.dedent("""
     name>=1.5;python_version=='3.6'
     name>=1.2,!=1.4;python_version=='2.6'
     """)
     reqs = [r for r, line in requirement.parse(r_content)['name']]
     branch_reqs = check.RequirementsList(
         'testproj',
         {'requirements': {
             'requirements.txt': ''
         }},
     )
     branch_reqs.process(False)
     global_reqs = check.get_global_reqs(
         textwrap.dedent("""
     name>=1.5;python_version=='3.5'
     name>=1.2,!=1.4;python_version=='2.6'
     """))
     self.assertTrue(
         check._validate_one(
             'name',
             reqs=reqs,
             branch_reqs=branch_reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         ))
Ejemplo n.º 2
0
 def test_not_in_global_list(self):
     # If the package is not in the global list, that is an error.
     reqs = [r for r, line in requirement.parse('name>=1.2,!=1.4')['name']]
     global_reqs = check.get_global_reqs('')
     self.assertTrue(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         ))
Ejemplo n.º 3
0
 def test_new_item_matches_global_list(self):
     # If the new item matches the global list exactly that is OK.
     reqs = [r for r, line in requirement.parse('name>=1.2,!=1.4')['name']]
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         ))
Ejemplo n.º 4
0
 def test_blacklisted(self):
     # If the package is blacklisted, everything is OK.
     reqs = [r for r, line in requirement.parse('name>=1.2,!=1.4')['name']]
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse('name'),
             global_reqs=global_reqs,
         ))
Ejemplo n.º 5
0
 def test_new_item_lower_min(self):
     # If the new item has a lower minimum value than the global
     # list, that is OK.
     reqs = [r for r, line in requirement.parse('name>=1.1,!=1.4')['name']]
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         ))
Ejemplo n.º 6
0
 def test_blacklisted_mismatch(self):
     # If the package is blacklisted, it doesn't matter if the
     # version matches.
     reqs = [r for r, line in requirement.parse('name>=1.5')['name']]
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse('name'),
             global_reqs=global_reqs,
         ))
Ejemplo n.º 7
0
 def test_new_item_missing_exclusion(self):
     # If the new item does not include an exclusion that is
     # present in the global list that is OK.
     reqs = [r for r, line in requirement.parse('name>=1.2')['name']]
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         ))
Ejemplo n.º 8
0
 def test_unchanged(self):
     # If the line matches the value in the branch list everything
     # is OK.
     reqs = [r for r, line in requirement.parse('name>=1.2,!=1.4')['name']]
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         ))
Ejemplo n.º 9
0
 def test_new_item_extra_exclusion(self):
     # If the new item includes an exclusion that is not present in
     # the global list that is not OK.
     reqs = [
         r for r, line in requirement.parse('name>=1.2,!=1.4,!=1.5')['name']
     ]
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertTrue(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         ))
Ejemplo n.º 10
0
 def test_blacklisted(self):
     # If the package is blacklisted, everything is OK.
     reqs = [
         r
         for r, line in requirement.parse('name>=1.2,!=1.4')['name']
     ]
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse('name'),
             global_reqs=global_reqs,
         )
     )
Ejemplo n.º 11
0
 def test_not_in_global_list(self):
     # If the package is not in the global list, that is an error.
     reqs = [
         r
         for r, line in requirement.parse('name>=1.2,!=1.4')['name']
     ]
     global_reqs = check.get_global_reqs('')
     self.assertTrue(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         )
     )
Ejemplo n.º 12
0
 def test_new_item_matches_global_list(self):
     # If the new item matches the global list exactly that is OK.
     reqs = [
         r
         for r, line in requirement.parse('name>=1.2,!=1.4')['name']
     ]
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         )
     )
Ejemplo n.º 13
0
 def test_unchanged(self):
     # If the line matches the value in the branch list everything
     # is OK.
     reqs = [
         r
         for r, line in requirement.parse('name>=1.2,!=1.4')['name']
     ]
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         )
     )
Ejemplo n.º 14
0
 def test_blacklisted_mismatch(self):
     # If the package is blacklisted, it doesn't matter if the
     # version matches.
     reqs = [
         r
         for r, line in requirement.parse('name>=1.5')['name']
     ]
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse('name'),
             global_reqs=global_reqs,
         )
     )
Ejemplo n.º 15
0
 def test_new_item_lower_min(self):
     # If the new item has a lower minimum value than the global
     # list, that is OK.
     reqs = [
         r
         for r, line in requirement.parse('name>=1.1,!=1.4')['name']
     ]
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         )
     )
Ejemplo n.º 16
0
 def test_new_item_missing_exclusion(self):
     # If the new item does not include an exclusion that is
     # present in the global list that is OK.
     reqs = [
         r
         for r, line in requirement.parse('name>=1.2')['name']
     ]
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         )
     )
Ejemplo n.º 17
0
 def test_new_item_extra_exclusion(self):
     # If the new item includes an exclusion that is not present in
     # the global list that is not OK.
     reqs = [
         r
         for r, line in requirement.parse('name>=1.2,!=1.4,!=1.5')['name']
     ]
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertTrue(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         )
     )
Ejemplo n.º 18
0
 def test_not_in_global_list(self):
     # If the package is not in the global list, that is an error.
     reqs = [r for r, line in requirement.parse('name>=1.2,!=1.4')['name']]
     branch_reqs = check.RequirementsList(
         'testproj',
         {'requirements': {
             'requirements.txt': 'name>=1.2,!=1.4'
         }},
     )
     branch_reqs.process(False)
     global_reqs = check.get_global_reqs('')
     self.assertTrue(
         check._validate_one(
             'name',
             reqs=reqs,
             branch_reqs=branch_reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         ))
Ejemplo n.º 19
0
 def test_new_item_matches_global_list(self):
     # If the new item matches the global list exactly that is OK.
     reqs = [r for r, line in requirement.parse('name>=1.2,!=1.4')['name']]
     branch_reqs = check.RequirementsList(
         'testproj',
         {'requirements': {
             'requirements.txt': ''
         }},
     )
     branch_reqs.process(False)
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             branch_reqs=branch_reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         ))
Ejemplo n.º 20
0
 def test_blacklisted(self):
     # If the package is blacklisted, everything is OK.
     reqs = [r for r, line in requirement.parse('name>=1.2,!=1.4')['name']]
     branch_reqs = check.RequirementsList(
         'testproj',
         {'requirements': {
             'requirements.txt': 'name>=1.2,!=1.4'
         }},
     )
     branch_reqs.process(False)
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             branch_reqs=branch_reqs,
             blacklist=requirement.parse('name'),
             global_reqs=global_reqs,
         ))
Ejemplo n.º 21
0
 def test_new_item_lower_min(self):
     # If the new item has a lower minimum value than the global
     # list, that is OK.
     reqs = [r for r, line in requirement.parse('name>=1.1,!=1.4')['name']]
     branch_reqs = check.RequirementsList(
         'testproj',
         {'requirements': {
             'requirements.txt': ''
         }},
     )
     branch_reqs.process(False)
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             branch_reqs=branch_reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         ))
Ejemplo n.º 22
0
 def test_new_item_missing_exclusion(self):
     # If the new item does not include an exclusion that is
     # present in the global list that is OK.
     reqs = [r for r, line in requirement.parse('name>=1.2')['name']]
     branch_reqs = check.RequirementsList(
         'testproj',
         {'requirements': {
             'requirements.txt': ''
         }},
     )
     branch_reqs.process(False)
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             branch_reqs=branch_reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         ))
Ejemplo n.º 23
0
 def test_new_item_matches_py3_allowed_no_py2(self):
     # If the global list has multiple entries for an item but the branch
     # allows python 3 only, then only the py3 entries need to match.
     r_content = textwrap.dedent("""
     name>=1.5;python_version=='3.5'
     """)
     reqs = [r for r, line in requirement.parse(r_content)['name']]
     global_reqs = check.get_global_reqs(
         textwrap.dedent("""
     name>=1.5;python_version=='3.5'
     name>=1.2,!=1.4;python_version=='2.6'
     """))
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
             allow_3_only=True,
         ))
Ejemplo n.º 24
0
 def test_blacklisted_mismatch(self):
     # If the package is blacklisted, it doesn't matter if the
     # version matches.
     reqs = [r for r, line in requirement.parse('name>=1.5')['name']]
     branch_reqs = check.RequirementsList(
         'testproj',
         {'requirements': {
             'requirements.txt': 'name>=1.2,!=1.4'
         }},
     )
     branch_reqs.process(False)
     global_reqs = check.get_global_reqs('name>=1.2,!=1.4')
     self.assertFalse(
         check._validate_one(
             'name',
             reqs=reqs,
             branch_reqs=branch_reqs,
             blacklist=requirement.parse('name'),
             global_reqs=global_reqs,
         ))
Ejemplo n.º 25
0
 def test_new_item_missing_extra_line(self):
     # If the global list has multiple entries for an item with
     # different "extra" specifiers, the values must all be in the
     # requirements file.
     r_content = textwrap.dedent("""
     name>=1.2,!=1.4;python_version=='2.6'
     """)
     reqs = [r for r, line in requirement.parse(r_content)['name']]
     global_reqs = check.get_global_reqs(
         textwrap.dedent("""
     name>=1.5;python_version=='3.5'
     name>=1.2,!=1.4;python_version=='2.6'
     """))
     self.assertTrue(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         ))
Ejemplo n.º 26
0
 def test_new_item_missing_extra_line(self):
     # If the global list has multiple entries for an item with
     # different "extra" specifiers, the values must all be in the
     # requirements file.
     r_content = textwrap.dedent("""
     name>=1.2,!=1.4;python_version=='2.6'
     """)
     reqs = [
         r
         for r, line in requirement.parse(r_content)['name']
     ]
     global_reqs = check.get_global_reqs(textwrap.dedent("""
     name>=1.5;python_version=='3.5'
     name>=1.2,!=1.4;python_version=='2.6'
     """))
     self.assertTrue(
         check._validate_one(
             'name',
             reqs=reqs,
             blacklist=requirement.parse(''),
             global_reqs=global_reqs,
         )
     )