Handling Python version differences in test cases

Is there a preferred method to handle different python versions in an Evaluate clause.

The specific case is with a change introduced with Python 3.7. The errno was “moved” from the “os” module into it’s own module (e.g. os.errno.XXX => errno.XXX).

The Evaluate clause in this case is:
$(res)= .Evaluate os.errno.EXDEV module=os

Thanks

I run and develop all my tests, at work, by using single Python version. CI has the same version, all that are developing tests are using same version. Single version to rule everything. Also dependencies are pinned, everyone is using same versions.

Tests automation should be seen as a product, in same way as things you are selling to the customers. It should be build and packaged automatically by a CI. Everything that goes into the package is living in a version control, in one way or another. Package can be easily get from a some sort of blob storage and so on.

1 Like

The problem in this case is that the test automation needs to running on various distributions at various maintenance levels with different levels of Python installed (there is a commitment to backward compatibility and a requirement to support older platforms).

I’d just move the eval part into python module and call it as a keyword. Then, in python side, you can then detect which python version is running and use appropriate code for that particular version…

Or alternatively, make a separate keyword for each python that uses correct eval for that particular version, then use sys.version_info.manor and sys.version_info.minor along with Run Keyword If to compare against manor/minor version parts and run the particular keyword for that combination …