1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-12-22 08:47:41 +00:00

Fix 2.6 nosetests

This commit is contained in:
Philipp Hagemeister 2012-11-29 16:35:57 +01:00
parent 743b28ce11
commit 8af4ed7b4f
2 changed files with 6 additions and 4 deletions

View file

@ -52,13 +52,14 @@ try:
except AttributeError: # Python 2.6 except AttributeError: # Python 2.6
def _skip_unless(cond, reason='No reason given'): def _skip_unless(cond, reason='No reason given'):
def resfunc(f): def resfunc(f):
def wfunc(*args, **kwargs): # Start the function name with test to appease nosetests-2.6
def test_wfunc(*args, **kwargs):
if cond: if cond:
return f(*args, **kwargs) return f(*args, **kwargs)
else: else:
print('Skipped test') print('Skipped test')
return return
return wfunc return test_wfunc
return resfunc return resfunc
_skip = lambda *args, **kwargs: _skip_unless(False, *args, **kwargs) _skip = lambda *args, **kwargs: _skip_unless(False, *args, **kwargs)

View file

@ -38,13 +38,14 @@ try:
except AttributeError: # Python 2.6 except AttributeError: # Python 2.6
def _skip_unless(cond, reason='No reason given'): def _skip_unless(cond, reason='No reason given'):
def resfunc(f): def resfunc(f):
def wfunc(*args, **kwargs): # Start the function name with test to appease nosetests-2.6
def test_wfunc(*args, **kwargs):
if cond: if cond:
return f(*args, **kwargs) return f(*args, **kwargs)
else: else:
print('Skipped test') print('Skipped test')
return return
return wfunc return test_wfunc
return resfunc return resfunc
_skip = lambda *args, **kwargs: _skip_unless(False, *args, **kwargs) _skip = lambda *args, **kwargs: _skip_unless(False, *args, **kwargs)