def test_check_prog_with_args(self): config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "known-b", "known c"))', ["FOO=known-a"] ) self.assertEqual(status, 0) self.assertEqual(config, {"FOO": self.KNOWN_A}) self.assertEqual(out, "checking for foo... %s\n" % self.KNOWN_A) config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "known-b", "known c"))', ["FOO=%s" % self.KNOWN_A], ) self.assertEqual(status, 0) self.assertEqual(config, {"FOO": self.KNOWN_A}) self.assertEqual(out, "checking for foo... %s\n" % self.KNOWN_A) path = self.KNOWN_B.replace("known-b", "known-a") config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "known-b", "known c"))', ["FOO=%s" % path] ) self.assertEqual(status, 1) self.assertEqual(config, {}) self.assertEqual( out, textwrap.dedent( """\ checking for foo... not found DEBUG: foo: Looking for %s ERROR: Cannot find foo """ ) % path, ) config, out, status = self.get_result( 'check_prog("FOO", ("unknown",))', ["FOO=known c"] ) self.assertEqual(status, 0) self.assertEqual(config, {"FOO": fake_short_path(self.KNOWN_C)}) self.assertEqual( out, "checking for foo... %s\n" % shell_quote(fake_short_path(self.KNOWN_C)) ) config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "unknown-2", "unknown 3"), ' "allow_missing=True)", ["FOO=unknown"], ) self.assertEqual(status, 1) self.assertEqual(config, {}) self.assertEqual( out, textwrap.dedent( """\ checking for foo... not found DEBUG: foo: Looking for unknown ERROR: Cannot find foo """ ), )
def test_check_prog(self): config, out, status = self.get_result( 'check_prog("FOO", ("known-a",))') self.assertEqual(status, 0) self.assertEqual(config, {"FOO": self.KNOWN_A}) self.assertEqual(out, "checking for foo... %s\n" % self.KNOWN_A) config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "known-b", "known c"))') self.assertEqual(status, 0) self.assertEqual(config, {"FOO": self.KNOWN_B}) self.assertEqual(out, "checking for foo... %s\n" % self.KNOWN_B) config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "unknown-2", "known c"))') self.assertEqual(status, 0) self.assertEqual(config, {"FOO": fake_short_path(self.KNOWN_C)}) self.assertEqual( out, "checking for foo... %s\n" % shell_quote(fake_short_path(self.KNOWN_C))) config, out, status = self.get_result( 'check_prog("FOO", ("unknown",))') self.assertEqual(status, 1) self.assertEqual(config, {}) self.assertEqual( out, textwrap.dedent("""\ checking for foo... not found DEBUG: foo: Looking for unknown ERROR: Cannot find foo """), ) config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "unknown-2", "unknown 3"))') self.assertEqual(status, 1) self.assertEqual(config, {}) self.assertEqual( out, textwrap.dedent("""\ checking for foo... not found DEBUG: foo: Looking for unknown DEBUG: foo: Looking for unknown-2 DEBUG: foo: Looking for 'unknown 3' ERROR: Cannot find foo """), ) config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "unknown-2", "unknown 3"), ' "allow_missing=True)") self.assertEqual(status, 0) self.assertEqual(config, {}) self.assertEqual(out, "checking for foo... not found\n")
def test_check_prog(self): config, out, status = self.get_result( 'check_prog("FOO", ("known-a",))') self.assertEqual(status, 0) self.assertEqual(config, {'FOO': self.KNOWN_A}) self.assertEqual(out, 'checking for foo... %s\n' % self.KNOWN_A) config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "known-b", "known c"))') self.assertEqual(status, 0) self.assertEqual(config, {'FOO': self.KNOWN_B}) self.assertEqual(out, 'checking for foo... %s\n' % self.KNOWN_B) config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "unknown-2", "known c"))') self.assertEqual(status, 0) self.assertEqual(config, {'FOO': fake_short_path(self.KNOWN_C)}) self.assertEqual( out, "checking for foo... '%s'\n" % fake_short_path(self.KNOWN_C)) config, out, status = self.get_result( 'check_prog("FOO", ("unknown",))') self.assertEqual(status, 1) self.assertEqual(config, {}) self.assertEqual( out, textwrap.dedent('''\ checking for foo... not found DEBUG: foo: Trying unknown ERROR: Cannot find foo ''')) config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "unknown-2", "unknown 3"))') self.assertEqual(status, 1) self.assertEqual(config, {}) self.assertEqual( out, textwrap.dedent('''\ checking for foo... not found DEBUG: foo: Trying unknown DEBUG: foo: Trying unknown-2 DEBUG: foo: Trying 'unknown 3' ERROR: Cannot find foo ''')) config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "unknown-2", "unknown 3"), ' 'allow_missing=True)') self.assertEqual(status, 0) self.assertEqual(config, {'FOO': ':'}) self.assertEqual(out, 'checking for foo... not found\n')
def test_check_prog(self): config, out, status = self.get_result('check_prog("FOO", ("known-a",))') self.assertEqual(status, 0) self.assertEqual(config, {"FOO": self.KNOWN_A}) self.assertEqual(out, "checking for foo... %s\n" % self.KNOWN_A) config, out, status = self.get_result('check_prog("FOO", ("unknown", "known-b", "known c"))') self.assertEqual(status, 0) self.assertEqual(config, {"FOO": self.KNOWN_B}) self.assertEqual(out, "checking for foo... %s\n" % self.KNOWN_B) config, out, status = self.get_result('check_prog("FOO", ("unknown", "unknown-2", "known c"))') self.assertEqual(status, 0) self.assertEqual(config, {"FOO": fake_short_path(self.KNOWN_C)}) self.assertEqual(out, "checking for foo... '%s'\n" % fake_short_path(self.KNOWN_C)) config, out, status = self.get_result('check_prog("FOO", ("unknown",))') self.assertEqual(status, 1) self.assertEqual(config, {}) self.assertEqual( out, textwrap.dedent( """\ checking for foo... not found DEBUG: foo: Trying unknown ERROR: Cannot find foo """ ), ) config, out, status = self.get_result('check_prog("FOO", ("unknown", "unknown-2", "unknown 3"))') self.assertEqual(status, 1) self.assertEqual(config, {}) self.assertEqual( out, textwrap.dedent( """\ checking for foo... not found DEBUG: foo: Trying unknown DEBUG: foo: Trying unknown-2 DEBUG: foo: Trying 'unknown 3' ERROR: Cannot find foo """ ), ) config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "unknown-2", "unknown 3"), ' "allow_missing=True)" ) self.assertEqual(status, 0) self.assertEqual(config, {"FOO": ":"}) self.assertEqual(out, "checking for foo... not found\n")
def test_check_prog_with_args(self): config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "known-b", "known c"))', ['FOO=known-a']) self.assertEqual(status, 0) self.assertEqual(config, {'FOO': self.KNOWN_A}) self.assertEqual(out, 'checking for foo... %s\n' % self.KNOWN_A) config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "known-b", "known c"))', ['FOO=%s' % self.KNOWN_A]) self.assertEqual(status, 0) self.assertEqual(config, {'FOO': self.KNOWN_A}) self.assertEqual(out, 'checking for foo... %s\n' % self.KNOWN_A) path = self.KNOWN_B.replace('known-b', 'known-a') config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "known-b", "known c"))', ['FOO=%s' % path]) self.assertEqual(status, 1) self.assertEqual(config, {}) self.assertEqual( out, textwrap.dedent('''\ checking for foo... not found DEBUG: foo: Trying %s ERROR: Cannot find foo ''') % path) config, out, status = self.get_result( 'check_prog("FOO", ("unknown",))', ['FOO=known c']) self.assertEqual(status, 0) self.assertEqual(config, {'FOO': fake_short_path(self.KNOWN_C)}) self.assertEqual( out, "checking for foo... %s\n" % shell_quote(fake_short_path(self.KNOWN_C))) config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "unknown-2", "unknown 3"), ' 'allow_missing=True)', ['FOO=unknown']) self.assertEqual(status, 1) self.assertEqual(config, {}) self.assertEqual( out, textwrap.dedent('''\ checking for foo... not found DEBUG: foo: Trying unknown ERROR: Cannot find foo '''))
def test_check_prog_with_args(self): config, out, status = self.get_result('check_prog("FOO", ("unknown", "known-b", "known c"))', ["FOO=known-a"]) self.assertEqual(status, 0) self.assertEqual(config, {"FOO": self.KNOWN_A}) self.assertEqual(out, "checking for foo... %s\n" % self.KNOWN_A) config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "known-b", "known c"))', ["FOO=%s" % self.KNOWN_A] ) self.assertEqual(status, 0) self.assertEqual(config, {"FOO": self.KNOWN_A}) self.assertEqual(out, "checking for foo... %s\n" % self.KNOWN_A) path = self.KNOWN_B.replace("known-b", "known-a") config, out, status = self.get_result('check_prog("FOO", ("unknown", "known-b", "known c"))', ["FOO=%s" % path]) self.assertEqual(status, 1) self.assertEqual(config, {}) self.assertEqual( out, textwrap.dedent( """\ checking for foo... not found DEBUG: foo: Trying %s ERROR: Cannot find foo """ ) % path, ) config, out, status = self.get_result('check_prog("FOO", ("unknown",))', ["FOO=known c"]) self.assertEqual(status, 0) self.assertEqual(config, {"FOO": fake_short_path(self.KNOWN_C)}) self.assertEqual(out, "checking for foo... '%s'\n" % fake_short_path(self.KNOWN_C)) config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "unknown-2", "unknown 3"), ' "allow_missing=True)", ["FOO=unknown"] ) self.assertEqual(status, 1) self.assertEqual(config, {}) self.assertEqual( out, textwrap.dedent( """\ checking for foo... not found DEBUG: foo: Trying unknown ERROR: Cannot find foo """ ), )
def test_check_prog_with_args(self): config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "known-b", "known c"))', ['FOO=known-a']) self.assertEqual(status, 0) self.assertEqual(config, {'FOO': self.KNOWN_A}) self.assertEqual(out, 'checking for foo... %s\n' % self.KNOWN_A) config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "known-b", "known c"))', ['FOO=%s' % self.KNOWN_A]) self.assertEqual(status, 0) self.assertEqual(config, {'FOO': self.KNOWN_A}) self.assertEqual(out, 'checking for foo... %s\n' % self.KNOWN_A) path = self.KNOWN_B.replace('known-b', 'known-a') config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "known-b", "known c"))', ['FOO=%s' % path]) self.assertEqual(status, 1) self.assertEqual(config, {}) self.assertEqual(out, textwrap.dedent('''\ checking for foo... not found DEBUG: foo: Trying %s ERROR: Cannot find foo ''') % path) config, out, status = self.get_result( 'check_prog("FOO", ("unknown",))', ['FOO=known c']) self.assertEqual(status, 0) self.assertEqual(config, {'FOO': fake_short_path(self.KNOWN_C)}) self.assertEqual(out, "checking for foo... '%s'\n" % fake_short_path(self.KNOWN_C)) config, out, status = self.get_result( 'check_prog("FOO", ("unknown", "unknown-2", "unknown 3"), ' 'allow_missing=True)', ['FOO=unknown']) self.assertEqual(status, 1) self.assertEqual(config, {}) self.assertEqual(out, textwrap.dedent('''\ checking for foo... not found DEBUG: foo: Trying unknown ERROR: Cannot find foo '''))