Issue2291

classification
Title: Allow to set version-related attributes in sys module
Type: Severity: normal
Components: Core Versions: Jython 2.7
Milestone: Jython 2.7.2
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Arfrever, zyasoft
Priority: high Keywords:

Created on 2015-03-13.11:34:22 by Arfrever, last changed 2015-12-29.23:47:54 by zyasoft.

Messages
msg9644 (view) Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) Date: 2015-03-13.11:34:21
Test suite of logilab-common-0.63.2 temporarily changes sys.version_info:


    def setUp(self):
        self.pyversion = sys.version_info

    def tearDown(self):
        sys.version_info = self.pyversion

    def test_require_version_good(self):
        """ should return the same function
        """
        def func() :
            pass
        sys.version_info = (2, 5, 5, 'final', 4)
        current = sys.version_info[:3]
        compare = ('2.4', '2.5', '2.5.4', '2.5.5')
        for version in compare:
            decorator = require_version(version)
            self.assertEqual(func, decorator(func), '%s =< %s : function \
                return by the decorator should be the same.' % (version,
                '.'.join([str(element) for element in current])))

    def test_require_version_bad(self):
        """ should return a different function : skipping test
        """
        def func() :
            pass
        sys.version_info = (2, 5, 5, 'final', 4)
        current = sys.version_info[:3]
        compare = ('2.5.6', '2.6', '2.6.5')
        for version in compare:
            decorator = require_version(version)
            self.assertNotEqual(func, decorator(func), '%s >= %s : function \
                 return by the decorator should NOT be the same.'
                 % ('.'.join([str(element) for element in current]), version))


I suggest to allow setting of version-related attributes:
sys._mercurial
sys.hexversion
sys.subversion
sys.version
sys.version_info

(See also bug #2290.)
msg9646 (view) Author: Jim Baker (zyasoft) Date: 2015-03-13.18:38:30
Hmmm, I suppose we could allow for this fiction, even though we generally prefer statics like these to be final.
msg9671 (view) Author: Jim Baker (zyasoft) Date: 2015-03-18.03:24:04
Defer to 2.7.1
History
Date User Action Args
2015-12-29 23:47:54zyasoftsetmilestone: Jython 2.7.1 -> Jython 2.7.2
2015-04-20 20:57:13zyasoftsetmilestone: Jython 2.7.1
2015-03-18 03:24:04zyasoftsetpriority: high
messages: + msg9671
2015-03-13 18:38:30zyasoftsetmessages: + msg9646
2015-03-13 11:34:36Arfreversetcomponents: + Core
2015-03-13 11:34:22Arfrevercreate