Respect priority when loading entry-points
if one tries to run bob/bob.bio.base tests in an environment with bob/bob.bio.spear installed, the test bob.bio.base.test.test_utils.test_grid
is not going to pass with the following error:
======================================================================
ERROR: bob.bio.base.test.test_utils.test_grid
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vagrant/anaconda/envs/bob_py27/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/home/vagrant/anaconda/envs/bob_py27/lib/python2.7/site-packages/bob/bio/base/test/test_utils.py", line 34, in test_grid
g = bob.bio.base.load_resource("demanding", "grid")
File "/home/vagrant/anaconda/envs/bob_py27/lib/python2.7/site-packages/bob/bio/base/utils/resources.py", line 204, in load_resource
return entry_points[0].load()
File "/home/vagrant/anaconda/envs/bob_py27/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2291, in load
return self.resolve()
File "/home/vagrant/anaconda/envs/bob_py27/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2297, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/home/vagrant/anaconda/envs/bob_py27/lib/python2.7/site-packages/bob/bio/spear/config/grid/demanding.py", line 15, in <module>
scoring_queue = '8G-io-big'
File "/home/vagrant/anaconda/envs/bob_py27/lib/python2.7/site-packages/bob/bio/base/grid.py", line 107, in __init__
self.training_queue = self.queue(training_queue)
File "/home/vagrant/anaconda/envs/bob_py27/lib/python2.7/site-packages/bob/bio/base/grid.py", line 140, in queue
raise ValueError("The given queue parameters '%s' are not in the predefined queues and neither a dictionary with values." % str(params))
ValueError: The given queue parameters '48G' are not in the predefined queues and neither a dictionary with values.
-------------------- >> begin captured logging << --------------------
bob.bio.base: WARNING: Under the desired name 'demanding', there are multiple entry points defined, we return the first one: ['bob.bio.spear.config.grid.demanding', 'bob.bio.base.config.grid.demanding']
--------------------- >> end captured logging << ---------------------
The reason for this error is that there is a resource called demanding
on both packages. For some reason, the test is choosing the version on spear, which does not work.