Skip to content
This repository has been archived by the owner on May 28, 2022. It is now read-only.

Fix the firewiresrc/__init__.py file to allow unit testing #644

Open
SRomansky opened this issue Nov 4, 2014 · 0 comments
Open

Fix the firewiresrc/__init__.py file to allow unit testing #644

SRomansky opened this issue Nov 4, 2014 · 0 comments
Labels

Comments

@SRomansky
Copy link
Contributor

We're currently unable to properly test the VideoInput plugin due to lack of Firewire support. There is a linkage issue that we're currently skipping in the tests (but not skipped below to show how it fails).

It could be useful for the firewire plugin to detect if a users computer has a firewire port. For example, if the user tries to use the plugin and they do not have a firewire port raise an exception. Otherwise, if a firewire port is present on the user's computer, load the firewire plugin as expected.

=================================== FAILURES ===================================
_______________ test_plugin_bin[plugin_info2-expected_instance2] _______________

plugin_manager = <freeseer.framework.plugin.PluginManager object at 0x7f04682b9a68>
plugin_info = ('VideoInput', 'get_videoinput_bin')
expected_instance = <type 'gst.Bin'>

    @pytest.mark.parametrize('plugin_info, expected_instance', [
        (('AudioInput', 'get_audioinput_bin'), gst.Bin),
        (('AudioMixer', 'get_audiomixer_bin'), gst.Bin),
        (('VideoInput', 'get_videoinput_bin'), gst.Bin),
        (('VideoMixer', 'get_videomixer_bin'), gst.Bin),
        (('Output', 'get_output_bin'), gst.Bin)
    ])
    def test_plugin_bin(plugin_manager, plugin_info, expected_instance):
        """Check that a plugin and its get method returns the proper gst.Bin object"""
        plugin_name, get_plugin_method = plugin_info
        plugins = plugin_manager.get_plugins_of_category(plugin_name)

        for plugin in plugins:
            plugin.plugin_object.load_config(plugin_manager)
    #        if plugin.name == "Firewire Source":
    #            continue
>           plugin_bin = getattr(plugin.plugin_object, get_plugin_method)()

freeseer/tests/framework/test_plugins.py:59: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <yapsy_loaded_plugin_Firewire_Source_19.FirewireSrc object at 0x7f04600dce90>

    def get_videoinput_bin(self):
        bin = gst.Bin()  # Do not pass a name so that we can load this input more than once.

        videosrc = gst.element_factory_make("dv1394src", "videosrc")
        dv1394q1 = gst.element_factory_make('queue', 'dv1394q1')
        dv1394dvdemux = gst.element_factory_make('dvdemux', 'dv1394dvdemux')
        dv1394q2 = gst.element_factory_make('queue', 'dv1394q2')
        dv1394dvdec = gst.element_factory_make('dvdec', 'dv1394dvdec')

        # Add Elements
        bin.add(videosrc)
        bin.add(dv1394q1)
        bin.add(dv1394dvdemux)
        bin.add(dv1394q2)
        bin.add(dv1394dvdec)

        # Link Elements
        videosrc.link(dv1394q1)
        dv1394q1.link(dv1394dvdemux)
>       dv1394dvdemux.link(dv1394q2)
E       LinkError: failed to link dv1394dvdemux with dv1394q2

freeseer/plugins/videoinput/firewiresrc/__init__.py:100: LinkError
------------------------------- Captured stderr --------------------------------
2014-11-03 16:52:49,449 (   DEBUG) freeseer.framework.plugin               : Plugin manager initialized.
--------------- coverage: platform linux2, python 2.7.6-final-0 ----------------
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants