def skip_test_if_missing_features(test): for feature in vars(test).get("features", list()): if not test.caps.get("features", dict()).get(feature, False): slash.skip_test( format_value( "{platform}.{driver}.feature({feature}) not supported", **vars(test), feature = feature))
def test_skip_test(self): "Make sure the skip_test function raises a SkipTest exception" for args in [ (), ("message",) ]: with self.assertRaises(slash.exceptions.SkipTest) as caught: slash.skip_test(*args) if args: self.assertEquals(caught.exception.reason, args[0])
def validate_caps(self): self.hwformat = map_best_hw_format(self.format, self.caps["fmts"]) self.mformat = mapformat(self.format) if None in [self.hwformat, self.mformat]: slash.skip_test( "{format} format not supported".format(**vars(self))) maxw, maxh = self.caps["maxres"] if self.width > maxw or self.height > maxh: slash.skip_test( format_value( "{platform}.{driver}.{width}x{height} not supported", **vars(self))) skip_test_if_missing_features(self)
def test_thunderbird_browse(self): with self.measure(): if not self.start_imapapp(): slash.skip_test("Couldn't start ImapApp") tb = Thunderbird.Thunderbird(self.linux) tb.start() time.sleep(5) tb.drafts() time.sleep(3) tb.search('yoyoyo') time.sleep(3) tb.inbox() time.sleep(3) tb.trash() time.sleep(20) tb.stop()
def test_thunderbird_compose(self): with self.measure(): if not self.start_imapapp(): slash.skip_test("Couldn't start ImapApp") tb = Thunderbird.Thunderbird(self.linux) tb.start() time.sleep(5) composer = tb.compose() time.sleep(4) composer.to(('*****@*****.**',)) time.sleep(3) composer.subject('This is a Subject') time.sleep(3) composer.body("This is the email's body") time.sleep(3) composer.save() time.sleep(20) tb.stop()
def validate_caps(self): skip_test_if_missing_features(self) self.encoder = self.EncoderClass(**vars(self)) self.decoder = self.DecoderClass( gstdecoder=self.gstdecoder, gstparser=vars(self).get("gstparser", None), gstdemuxer=vars(self).get("gstdemuxer", None), frames=self.frames, format=self.format, ) if None in [ self.encoder.hwformat, self.encoder.format, self.decoder.format ]: slash.skip_test( "{format} format not supported".format(**vars(self))) maxw, maxh = self.caps["maxres"] if self.width > maxw or self.height > maxh: slash.skip_test( format_value( "{platform}.{driver}.{width}x{height} not supported", **vars(self))) if vars(self).get("slices", 1) > 1 and not self.caps.get( "multislice", True): slash.skip_test( format_value( "{platform}.{driver}.slice > 1 unsupported in this mode", **vars(self))) if not self.caps.get(self.rcmode, True): slash.skip_test( format_value( "{platform}.{driver}.{rcmode} unsupported in this mode", **vars(self))) if vars(self).get("profile", None) is not None: self.mprofile = self.map_profile() if self.mprofile is None: slash.skip_test( "{profile} profile is not supported".format(**vars(self))) self.encoder.update(profile=self.mprofile)
def validate_caps(self): ifmts = self.caps["fmts"] ## BUG: It appears there's a ffmpeg bug with yuv420p hwupload when using ## i965 driver. Need to report upstream ffmpeg! if "i965" == get_media()._get_driver_name(): ifmts = list(set(ifmts) - set(["I420"])) self.hwformat = map_best_hw_format(self.format, ifmts) self.mformat = mapformat(self.format) if None in [self.hwformat, self.mformat]: slash.skip_test("{format} not supported".format(**vars(self))) skip_test_if_missing_features(self) maxw, maxh = self.caps["maxres"] if self.width > maxw or self.height > maxh: slash.skip_test( format_value( "{platform}.{driver}.{width}x{height} not supported", **vars(self))) if vars(self).get("slices", 1) > 1 and not self.caps.get( "multislice", True): slash.skip_test( format_value( "{platform}.{driver}.slice > 1 unsupported in this mode", **vars(self))) if not self.caps.get(self.rcmode, True): slash.skip_test( format_value( "{platform}.{driver}.{rcmode} unsupported in this mode", **vars(self))) if vars(self).get("profile", None) is not None: self.mprofile = self.map_profile() if self.mprofile is None: slash.skip_test( "{profile} profile is not supported".format(**vars(self)))
def validate_caps(self): ifmts = self.get_input_formats() ofmts = self.get_output_formats() self.ifmt = self.format self.ofmt = self.format if "csc" != self.vpp_op else self.csc self.mformat = self.map_format(self.format) self.mformatu = self.map_formatu(self.format) if self.mformat is None: slash.skip_test("{gstvpp}.{format} unsupported".format(**vars(self))) if "csc" == self.vpp_op: self.ihwformat = self.map_formatu(self.ifmt if self.ifmt in ifmts else None) self.ohwformat = self.map_formatu(self.ofmt if self.ofmt in ofmts else None) else: self.ihwformat = self.map_best_hw_format(self.ifmt, ifmts) self.ohwformat = self.map_best_hw_format(self.ofmt, ofmts) if self.ihwformat is None: slash.skip_test("{ifmt} unsupported".format(**vars(self))) if self.ohwformat is None: slash.skip_test("{ofmt} unsupported".format(**vars(self)))
def test_skip_test(args): "Make sure the skip_test function raises a SkipTest exception" with pytest.raises(slash.exceptions.SkipTest) as caught: slash.skip_test(*args) if args: assert caught.value.reason == args[0]
def test(self): slash.skip_test("!")
def before(self): slash.skip_test("context skipped")
def __code__(): def callback(): __ut__.events.add('success_only_cleanup_called') # pylint: disable=undefined-variable slash.add_cleanup(callback, success_only=True) slash.skip_test()
def test_3(): slash.skip_test('skipped')
def _usr2_handler(*_, **__): skip_test("Skipped due to SIGUSR2 signal caught by {!r} plugin".format( _PLUGIN_NAME))
def __code__(): # pylint: disable=unused-variable from slash.exception_handling import handling_exceptions with handling_exceptions(swallow=True): slash.skip_test() __ut__.events.add('NEVER') # pylint: disable=undefined-variable
def __code__(): from slash.exception_handling import handling_exceptions with handling_exceptions(swallow=True): slash.skip_test() __ut__.events.add('NEVER')
def validate_caps(self): super().validate_caps() if vars(self).get("profile", None) in [ "main10sp" ] and not have_encode_main10sp(self.ffencoder): slash.skip_test(f"{self.ffencoder} main10sp not supported")
def validate_caps(self): assert len(self.outputs ), "Invalid test case specification, outputs data empty" assert self.mode in [ "sw", "hw" ], "Invalid test case specification as mode type not valid" icaps, ireq, _ = self.get_requirements_data("decode", self.codec, self.mode) requires = [ ireq, ] if icaps is None: slash.skip_test( "decode.{codec}.{mode} unsupported".format(**vars(self))) maxw, maxh = icaps["maxres"] if self.width > maxw or self.height > maxh: slash.skip_test( "decode.{codec}.{mode}.{width}x{height} unsupported".format( **vars(self))) for output in self.outputs: codec = output["codec"] mode = output["mode"] assert mode in [ "sw", "hw", "lp" ], "Invalid test case specification as output mode type not valid" ocaps, oreq, _ = self.get_requirements_data("encode", codec, mode) requires.append(oreq) if ocaps is None: slash.skip_test("encode.{codec}.{mode} unsupported".format( codec=codec, mode=mode)) maxw, maxh = ocaps["maxres"] w = output.get("width", None) h = output.get("height", None) if (w or self.width) > maxw or (h or self.height) > maxh: slash.skip_test( "encode.{codec}.{mode}.{width}x{height} unsupported". format(codec=codec, mode=mode, width=(w or self.width), height=(h or self.height))) if w is not None or h is not None: ocaps, oreq, _ = self.get_requirements_data( "vpp", "scale", mode) requires.append(oreq) if ocaps is None: slash.skip_test( "vpp.scale.{mode} unsupported".format(mode=mode)) unmet = set([m for t, m in requires if not t]) if len(unmet) != 0: slash.skip_test( "Missing one or more required gstreamer elements: {}".format( list(unmet)))
def __code__(): def callback(): __ut__.events.add('success_only_cleanup_called') slash.add_cleanup(callback, success_only=True) slash.skip_test()