Skip to content

Commit 4dfe1f1

Browse files
committed
generaloption: deprecated SimpleOption descr argument
1 parent 84877a5 commit 4dfe1f1

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

lib/vsc/utils/generaloption.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,7 +1706,7 @@ class SimpleOptionParser(ExtOptionParser):
17061706
class SimpleOption(GeneralOption):
17071707
PARSER = SimpleOptionParser
17081708

1709-
def __init__(self, go_dict=None, short_groupdescr=None, long_groupdescr=None, config_files=None):
1709+
def __init__(self, go_dict=None, descr=None, short_groupdescr=None, long_groupdescr=None, config_files=None):
17101710
"""Initialisation
17111711
@param go_dict : General Option option dict
17121712
@param short_descr : short description of main options
@@ -1735,13 +1735,18 @@ def __init__(self, go_dict=None, short_groupdescr=None, long_groupdescr=None, co
17351735

17361736
super(SimpleOption, self).__init__(**kwargs)
17371737

1738+
if descr is not None:
1739+
# TODO: as there is no easy/clean way to access the version of the vsc-base package,
1740+
# this is equivalent to a warning
1741+
self.log.deprecated('SimpleOption descr argument', '2.5.0', '3.0.0')
1742+
17381743
def main_options(self):
17391744
if self.go_dict is not None:
17401745
prefix = None
17411746
self.add_group_parser(self.go_dict, self.descr, prefix=prefix)
17421747

17431748

1744-
def simple_option(go_dict=None, short_groupdescr=None, long_groupdescr=None, config_files=None):
1749+
def simple_option(go_dict=None, descr=None, short_groupdescr=None, long_groupdescr=None, config_files=None):
17451750
"""A function that returns a single level GeneralOption option parser
17461751
17471752
@param go_dict : General Option option dict
@@ -1755,4 +1760,4 @@ def simple_option(go_dict=None, short_groupdescr=None, long_groupdescr=None, con
17551760
17561761
the generated help will include the docstring
17571762
"""
1758-
return SimpleOption(go_dict=go_dict, short_groupdescr=short_groupdescr, long_groupdescr=long_groupdescr, config_files=config_files)
1763+
return SimpleOption(go_dict=go_dict, descr=descr, short_groupdescr=short_groupdescr, long_groupdescr=long_groupdescr, config_files=config_files)

test/run.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def test_timeout(self):
8787
self.assertEqual(RUNRUN_TIMEOUT_OUTPUT, output, msg='longsleep expected output')
8888
self.assertTrue(stop - start < timeout + 1, msg='longsleep timeout within margin') # give 1 sec margin
8989

90-
# run_nested is also 10 seconds sleep
90+
# run_nested is 15 seconds sleep
9191
# 1st arg depth: 2 recursive starts
9292
# 2nd arg file: output file: format 'depth pid' (only other processes are sleep)
9393

@@ -114,8 +114,8 @@ def do_test(kill_pgid):
114114
self.assertEqual(ec, RUNRUN_TIMEOUT_EXITCODE, msg='run_nested kill_pgid %s stopped due to timeout' % kill_pgid)
115115
self.assertTrue(stop - start < timeout + 1, msg='run_nested kill_pgid %s timeout within margin' % kill_pgid) # give 1 sec margin
116116
# make it's not too fast
117-
time.sleep(1)
118-
# there's now 5 seconds to complete the remainder
117+
time.sleep(5)
118+
# there's now 6 seconds to complete the remainder
119119
pids = range(depth+1)
120120
# normally this is ordered output, but you never know
121121
for line in open(res_fn).readlines():

test/runtests/run_nested.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
depth=${1:-1}
44
path=${2:-/dev/null}
55

6-
mysleep=10
6+
mysleep=15
77

88
echo "$depth $$ $PPID" >> $path
99

0 commit comments

Comments
 (0)