mirror of
https://github.com/psycopg/psycopg2.git
synced 2024-11-27 03:13:43 +03:00
Merge pull request #789 from jdufresne/argparse
Replace deprecated optparse usage with argparse
This commit is contained in:
commit
2e823273d6
|
@ -19,6 +19,7 @@ script exits with error 1.
|
||||||
# License for more details.
|
# License for more details.
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import argparse
|
||||||
import gc
|
import gc
|
||||||
import sys
|
import sys
|
||||||
import difflib
|
import difflib
|
||||||
|
@ -62,19 +63,16 @@ def main():
|
||||||
|
|
||||||
|
|
||||||
def parse_args():
|
def parse_args():
|
||||||
import optparse
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
|
parser.add_argument('--nruns', type=int, metavar="N", default=3,
|
||||||
parser = optparse.OptionParser(description=__doc__)
|
help="number of test suite runs [default: %(default)d]")
|
||||||
parser.add_option('--nruns', type='int', metavar="N", default=3,
|
parser.add_argument('--suite', metavar="NAME",
|
||||||
help="number of test suite runs [default: %default]")
|
|
||||||
parser.add_option('--suite', metavar="NAME",
|
|
||||||
help="the test suite to run (e.g. 'test_cursor'). [default: all]")
|
help="the test suite to run (e.g. 'test_cursor'). [default: all]")
|
||||||
parser.add_option('--objs', metavar="TYPE",
|
parser.add_argument('--objs', metavar="TYPE",
|
||||||
help="in case of leaks, print a report of object TYPE "
|
help="in case of leaks, print a report of object TYPE "
|
||||||
"(support still incomplete)")
|
"(support still incomplete)")
|
||||||
|
|
||||||
opt, args = parser.parse_args()
|
return parser.parse_args()
|
||||||
return opt
|
|
||||||
|
|
||||||
|
|
||||||
def dump(i, opt):
|
def dump(i, opt):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user