def test_inspect_path(tmpdir): inspections = { 'bin': ['PATH'], 'man': ['MANPATH'], 'share/man': ['MANPATH'], 'share/aclocal': ['ACLOCAL_PATH'], 'lib': ['LIBRARY_PATH', 'LD_LIBRARY_PATH'], 'lib64': ['LIBRARY_PATH', 'LD_LIBRARY_PATH'], 'include': ['CPATH'], 'lib/pkgconfig': ['PKG_CONFIG_PATH'], 'lib64/pkgconfig': ['PKG_CONFIG_PATH'], '': ['CMAKE_PREFIX_PATH'] } tmpdir.chdir() tmpdir.mkdir('bin') tmpdir.mkdir('lib') tmpdir.mkdir('include') env = environment.inspect_path(str(tmpdir), inspections) names = [item.name for item in env] assert 'PATH' in names assert 'LIBRARY_PATH' in names assert 'LD_LIBRARY_PATH' in names assert 'CPATH' in names
def test_exclude_paths_from_inspection(): inspections = { 'lib': ['LIBRARY_PATH', 'LD_LIBRARY_PATH'], 'lib64': ['LIBRARY_PATH', 'LD_LIBRARY_PATH'], 'include': ['CPATH'] } env = environment.inspect_path('/usr', inspections, exclude=is_system_path) assert len(env) == 0
def test_exclude_paths_from_inspection(): inspections = { 'lib': ['LIBRARY_PATH', 'LD_LIBRARY_PATH'], 'lib64': ['LIBRARY_PATH', 'LD_LIBRARY_PATH'], 'include': ['CPATH'] } env = environment.inspect_path( '/usr', inspections, exclude=is_system_path ) assert len(env) == 0
def test_inspect_path(tmpdir): inspections = { 'bin': ['PATH'], 'man': ['MANPATH'], 'share/man': ['MANPATH'], 'share/aclocal': ['ACLOCAL_PATH'], 'lib': ['LIBRARY_PATH', 'LD_LIBRARY_PATH'], 'lib64': ['LIBRARY_PATH', 'LD_LIBRARY_PATH'], 'include': ['CPATH'], 'lib/pkgconfig': ['PKG_CONFIG_PATH'], 'lib64/pkgconfig': ['PKG_CONFIG_PATH'], '': ['CMAKE_PREFIX_PATH'] } tmpdir.mkdir('bin') tmpdir.mkdir('lib') tmpdir.mkdir('include') env = environment.inspect_path(str(tmpdir), inspections) names = [item.name for item in env] assert 'PATH' in names assert 'LIBRARY_PATH' in names assert 'LD_LIBRARY_PATH' in names assert 'CPATH' in names