Closed pguermo closed 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.
To david for code review
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.
Do you agree with the David's proposal?
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.
It works when imported in a controlscript or when imported in a TestScript! To dergo for code review
Reviewed code: ok for me.
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
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