Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Access Variable file module #3317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
OzairKhanBro opened this issue Sep 23, 2019 · 4 comments
Open

Access Variable file module #3317

OzairKhanBro opened this issue Sep 23, 2019 · 4 comments

Comments

@OzairKhanBro
Copy link

Hi. I am using aws glue etl job as a compute environment to run my long running test cases. For this purpose i have to create an .egg file of my robot framework keywords and attach this egg file with aws ETL job. so my veriables file script is in a module. So my question is

  1. is it possible to add my variable file as we add module
    current working solution:
    Variables path/folder/verifiable.py ${input}
    Expectation:
    Variables Module_name.veriable ${input}

Thanks

@pekkaklarck
Copy link
Member

This isn't possible at the moment. Variable files, like resource files, are always taken into use by using a path to the variable/resource file. Python (and Java) variable files could also be imported as modules same way as libraries, and I agree that would be a good idea. It would make it possible to include variables in normal Python packages, possibly even bundling them to same packages with libraries.

If the given path to resource/variable file doesn't match any file, Robot will automatically check is such a file found from directories in PYTHONPATH. This is not the same as importing discussed above, because the value still needs to be a path or file name like my_variables.py, not only the module name like my_variables. We are also kind of misusing PYTHONPATH, and should probably introduce our own environment variable like ROBOTPATH and search imported files from there instead.

Although I agree this would be a good idea, I cannot give promises when, if ever, this will be implemented. I'd like to have this in, but I doubt I have time in the near future. If someone else is interested to look at implementing this, I'd be happy to help. Shouldn't be overly complicated.

@OzairKhanBro
Copy link
Author

I am ready to work on this issue.

OzairKhanBro pushed a commit to OzairKhanBro/robotframework that referenced this issue Oct 19, 2019
@pekkaklarck
Copy link
Member

Cool! The first step would probably be changing Importer('variable file').import_class_or_module_by_path to use import_class_or_module instead. After that needs to see what acceptance tests possibly break (see atest/README.rst for details running then) and new tests need to be added.

OzairKhanBro added a commit to OzairKhanBro/robotframework that referenced this issue Dec 14, 2019
OzairKhanBro added a commit to OzairKhanBro/robotframework that referenced this issue Dec 14, 2019
@pekkaklarck
Copy link
Member

How does the implementation look like @OzairKhanBro? Anything I could already review?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants