Exemplo n.º 1
0
 def __setattr__(self, key, value):
     if value:
         if key == 'python_requires':
             check_specifier(self, key, value)
         elif key in ('install_requires', 'tests_require'):
             check_requirements(self, key, value)
         elif key == 'extras_require':
             check_extras(self, key, value)
     self[key] = value
Exemplo n.º 2
0
def test_check_specifier():
    # valid specifier value
    attrs = {'name': 'foo', 'python_requires': '>=3.0, !=3.1'}
    dist = Distribution(attrs)
    check_specifier(dist, attrs, attrs['python_requires'])

    # invalid specifier value
    attrs = {'name': 'foo', 'python_requires': ['>=3.0', '!=3.1']}
    with pytest.raises(DistutilsSetupError):
        dist = Distribution(attrs)