Message9644
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.) |
|
Date |
User |
Action |
Args |
2015-03-13 11:34:22 | Arfrever | set | recipients:
+ Arfrever, zyasoft |
2015-03-13 11:34:22 | Arfrever | set | messageid: <1426246462.26.0.828959814522.issue2291@psf.upfronthosting.co.za> |
2015-03-13 11:34:22 | Arfrever | link | issue2291 messages |
2015-03-13 11:34:21 | Arfrever | create | |
|