-
Notifications
You must be signed in to change notification settings - Fork 107
Conversation
for plugin in plugins: | ||
plugin.plugin_object.load_config(plugin_manager) | ||
if plugin.name == "Firewire Source": | ||
# There is an issue with Firewire Source in testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be better as a FIXME comment. Also refer to any related issues on GH if they exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, what exactly is the issue?
Edit: can you explain the issue in the comment and also link to relevant bug numbers so that the next person who looks at this code has a fighting chance of understanding it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure what the bug is. I thought https://github.com/Freeseer/freeseer/pull/589/files had discovered the bug but it appears it has not. I will look through git history to figure out when the comment was put it.
edit:
It appears that the firewire issue comment has existed since Freeseer was switch to git revision system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The follow error is thrown when the firewire conditional is removed from the loop. This error occurs in the firewire src plugin based when constructing the pipe for GStreamer.
=================================== 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":
# There is an issue with Firewire Source in testing found in gh#589
# Skip until this is resolved
# 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 ----------------
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#644 added and updated the code comment
|
On my laptop before caching the tests took 1.07 seconds to run, after caching 1.03 seconds. With a HDD the time difference would probably be even larger. |
for root, directory, files in os.walk(path, topdown=False): | ||
for filename in files: | ||
if filename.endswith(plugin_suffix): | ||
plugin_name = os.path.splitext(filename)[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's more pythonic to ignore the second element in the tuple instead of indexing.
plugin_name, _ = os.path.splitext(filename)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh that is a cool feature, implemented.
I think this is close to being merge-ready. Can you squash your commits? |
0cc13cc
to
3fbdda3
Compare
for plugin in plugins: | ||
if hasattr(plugin.plugin_object, 'config'): | ||
assert plugin.plugin_object.CONFIG_CLASS | ||
assert not plugin.config |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is plugin.config
correct or should it be plugin.plugin_object.config
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah. Plugin Manager does not have a config attribute. Only IBackendPlugin has a config attribute.
However, in the unit test I replaced the not, so it was assert plugin.plugin_object.config and it passed, then I tried assert not plugin.plugin_object.config and it also passed. Will look into this later today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that the plugin_object never has a config attribute. Hence the assertions are never called. I am looking for an example of a plugin loading a plugin configuration with plugin_object.load_config()
. However, freeseer/src$ grep -r load_config\(.*,.*,.*\) freeseer/plugins/
shows that there are no plugins who use the config arguement on the load_config function. (It should be the third value).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because the backend loads configuration when it needs it. See:
https://github.com/Freeseer/freeseer/blob/master/src/freeseer/framework/multimedia.py
|
||
from freeseer.framework.config.profile import ProfileManager | ||
from freeseer.framework.plugin import PluginManager | ||
from freeseer.framework.plugin import PluginManager, IAudioInput | ||
from freeseer.framework.config import Config, options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One import per line please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, sorry about that.
Is this good to go on your end? If so, please squash again. |
c9c9ada
to
24c7727
Compare
squashed |
Please fix your commit message to use proper issue referencing, see http://freeseer.readthedocs.org/en/latest/contribute/basics.html#reference-issues-in-your-commit-messages. The formatting you're using is only recognized by our IRC bot. |
- Refactor test_plugins to use pytest - add new functionality tests - Add FIXME comment for firewiresrc issue - Create git issue to track FIXME status - Add a plugin information cache fixture for test efficiency Fix Freeseer#642 Related to Freeseer#619 Related to Freeseer#484
24c7727
to
b4bceb2
Compare
Fixed, sorry about that. |
Merged as e1d1c42, thanks @wigglier. |
Improvement to the tests currently being run on
plugins.py
related #644