def assert_rpm_requires(test_case, expected_requirements, rpm_path):
 output = check_output(['rpm', '--query', '--requires', '--package', rpm_path.path])
 actual_requirements = set((line.strip() for line in output.splitlines()))
 expected_requirements = set(expected_requirements)
 missing_requirements = (expected_requirements - actual_requirements)
 if missing_requirements:
  test_case.fail('Missing requirements: {} in {}'.format(missing_requirements, rpm_path.path))

def assert_rpm_requires ( test_case , expected_requirements , rpm_path ) : output = check_output ( [ 'rpm' , '--query' , '--requires' , '--package' , rpm_path . path ] ) actual_requirements = set ( ( line . strip ( ) for line in output . splitlines ( ) ) ) expected_requirements = set ( expected_requirements ) missing_requirements = ( expected_requirements - actual_requirements ) if missing_requirements : test_case . fail ( 'Missing requirements: {} in {}' . format ( missing_requirements , rpm_path . path ) )
fail unless the rpm file at rpm_path has all the expected_requirements .