Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_cflags():
flags = pkgconfig.cflags(PACKAGE_NAME)
for flag in flags.split(' '):
assert flag in ('-DGSEAL_ENABLE', '-I/usr/include/gtk-3.0')
with pytest.raises(pkgconfig.PackageNotFoundError):
pkgconfig.cflags('doesnotexist')
def test_libs():
flags = pkgconfig.libs(PACKAGE_NAME)
for flag in flags.split(' '):
assert flag in ('-L/usr/lib_gtk_foo', '-lgtk-3')
with pytest.raises(pkgconfig.PackageNotFoundError):
pkgconfig.libs('doesnotexist')
def test_libs():
flags = pkgconfig.libs(PACKAGE_NAME)
for flag in flags.split(' '):
assert flag in ('-L/usr/lib_gtk_foo', '-lgtk-3')
with pytest.raises(pkgconfig.PackageNotFoundError):
pkgconfig.libs('doesnotexist')
def test_parse():
config = pkgconfig.parse("fake-gtk+-3.0 fake-python")
assert ('GSEAL_ENABLE', None) in config['define_macros']
assert '/usr/include/gtk-3.0' in config['include_dirs']
assert '/usr/lib_gtk_foo' in config['library_dirs']
assert '/usr/lib_python_foo' in config['library_dirs']
assert 'gtk-3' in config['libraries']
assert '/usr/include/python2.7' in config['include_dirs']
with pytest.raises(pkgconfig.PackageNotFoundError):
pkgconfig.parse('doesnotexist')
def test_parse():
config = pkgconfig.parse("fake-gtk+-3.0 fake-python")
assert ('GSEAL_ENABLE', None) in config['define_macros']
assert '/usr/include/gtk-3.0' in config['include_dirs']
assert '/usr/lib_gtk_foo' in config['library_dirs']
assert '/usr/lib_python_foo' in config['library_dirs']
assert 'gtk-3' in config['libraries']
assert '/usr/include/python2.7' in config['include_dirs']
with pytest.raises(pkgconfig.PackageNotFoundError):
pkgconfig.parse('doesnotexist')
def test_exists():
assert pkgconfig.exists(PACKAGE_NAME)
assert pkgconfig.exists('fake-openssl')
def test_variables():
variables = pkgconfig.variables('fake-python')
assert 'prefix' in variables
assert 'exec_prefix' in variables
assert 'libdir' in variables
assert 'includedir' in variables
assert variables['prefix'] == '/usr'
assert variables['exec_prefix'] == '/usr'
assert variables['libdir'] == '/usr/lib_python_foo'
assert variables['includedir'] == '/usr/include'
with pytest.raises(pkgconfig.PackageNotFoundError):
pkgconfig.variables('doesnotexist')
def test_variables():
variables = pkgconfig.variables('fake-python')
assert 'prefix' in variables
assert 'exec_prefix' in variables
assert 'libdir' in variables
assert 'includedir' in variables
assert variables['prefix'] == '/usr'
assert variables['exec_prefix'] == '/usr'
assert variables['libdir'] == '/usr/lib_python_foo'
assert variables['includedir'] == '/usr/include'
with pytest.raises(pkgconfig.PackageNotFoundError):
pkgconfig.variables('doesnotexist')
def test_modversion():
assert pkgconfig.modversion(PACKAGE_NAME) == '3.2.1'
assert pkgconfig.modversion('fake-openssl') == '1.1.0j'
with pytest.raises(pkgconfig.PackageNotFoundError):
pkgconfig.modversion('doesnotexist')
def test_modversion():
assert pkgconfig.modversion(PACKAGE_NAME) == '3.2.1'
assert pkgconfig.modversion('fake-openssl') == '1.1.0j'
with pytest.raises(pkgconfig.PackageNotFoundError):
pkgconfig.modversion('doesnotexist')