Status: New
Owner: ----
Labels: Type-Enhancement Priority-Medium

New issue 1546 by vadym.vi...@gmail.com: Libraries reset
http://code.google.com/p/robotframework/issues/detail?id=1546

The basic idea is to add an functionality to unload user libraries / resources from RF during tests execution. As result the pybot instance would have only standard libraries. It can be very useful when several resource files with the same names/keywords should be accepted. Currently the RF has a limitation and requires unique user-keyword-library names.

Use case:
1. Import Resource  <path1>/libraries.txt
... do something with imported keywords
2. Import Reset (requested new keyword)
3. Import Resource   <path2>/libraries.txt
... do something with imported keywords

Actually the Library Search Order does not satisfy the requirements.

I have investigated how to change RF execution internally and I have got following:

from robot.libraries.BuiltIn import BuiltIn
from robot.running.importer import ImportCache
from robot.running import namespace

def import_reset():
    builtinlib = BuiltIn().get_library_instance('BuiltIn')
    builtinlib._namespace._testlibs.clear()
    builtinlib._namespace._imported_resource_files = ImportCache()
    builtinlib._namespace._imported_variable_files = ImportCache()
    namespace.IMPORTER.reset()
    builtinlib._namespace._import_default_libraries()

It can help you to implement requested feature

Thanks,
Vadym

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--

--- You received this message because you are subscribed to the Google Groups "robotframework-commit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to robotframework-commit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to