qspin / qtaste

[NEW RELEASE VERSION 3.0.0] The QTaste is an open-source functional and non-functional test environment offering services to developers and testers. It has been implemented following a data driven testing philosophy.
http://www.qtaste.org
GNU Lesser General Public License v3.0
6 stars 11 forks source link

WARNING: Behaviour change between qtaste V2.x/jython 2.2.1 and qtaste V3.x/jython 2.7.0 - Potentially backwards breaking changes #211

Closed pguermo closed 7 years ago

pguermo commented 7 years ago

The method os.getlogin() is corrupted in jython 2.7.0 (http://bugs.jython.org/issue2534: os.getlogin() returns a wrong user or returns an exception)

The method may be fixed at QTaste level with this fix:

import os from com.qspin.qtaste.util import OS as _OS def getlogin(): if _OS.getType() == _OS.Type.WINDOWS: return os.getenv("USERNAME") return os.getenv("USER") os.getlogin = getlogin

This fix should be available when importing: from qtaste import from controlscript import

dergo commented 7 years ago

For me, it's not clear whether this is really a bug in jython 2.7, because the behavior is exactly the same with python 2.7: os.getlogin() works if jython/python is run from a real terminal (ctrl-alt-f1), but not when run in a terminal emulator like gnome-terminal.

lvboque commented 7 years ago

To david for code review

dergo commented 7 years ago

I don't agree with this "solution" at all. Jython 2.7.0 os.getlogin() is NOT corrupted, it's the previous behavior that was not correct. What you did is hack jython to reintroduce the bad behavior of previous version! This could lead to incorrect behavior of any python module using os.getlogin().

I revert the changes.

I propose that you instead add a getUserName() method on the com.qspin.qtaste.util.OS class, with following implementation (same as Jython 2.2.1 os.getlogin()), if really needed.

return System.getProperty("user.name")

But this method could also simply be defined in python in the client control script lib and global module for test scripts.

qspin commented 7 years ago

Do you agree with the David's proposal?

pguermo commented 7 years ago

Ok for me. As the next version of QTaste with Jython 2.7 will then break the behavior of some existing TestScripts, I suggest the next version of QTaste is a major one (3.0.0). A note in the release notes should notify the user about this risk.

lvboque commented 7 years ago

It works when imported in a controlscript or when imported in a TestScript! To dergo for code review

dergo commented 7 years ago

Reviewed code: ok for me.

lvboque commented 7 years ago

Other behaviour changes may appear and are linked to the new jython engine! Please consult the jython release notes for more details about the change introduced with that new version! https://hg.python.org/jython/file/412a8f9445f7/NEWS