File tree Expand file tree Collapse file tree 2 files changed +1
-23
lines changed
Expand file tree Collapse file tree 2 files changed +1
-23
lines changed Original file line number Diff line number Diff line change @@ -19,12 +19,7 @@ def short_desc(self):
1919
2020 def add_options (self , parser ):
2121 super ().add_options (parser )
22- # backward compatibility for optparse/argparse
23- try :
24- add_argument = parser .add_argument
25- except AttributeError :
26- add_argument = parser .add_option
27- add_argument (
22+ parser .add_argument (
2823 "--debug" ,
2924 action = "store_true" ,
3025 help = "add debugging information such as list of "
Original file line number Diff line number Diff line change 11
22from argparse import ArgumentParser
3- from optparse import OptionParser
43
54import pytest
65import scrapy
7- from packaging import version
86
97from sh_scrapy .commands .shub_image_info import Command
108
@@ -16,21 +14,6 @@ def command():
1614 return command
1715
1816
19- @pytest .mark .skipif (
20- version .parse (scrapy .__version__ ) >= version .parse ("2.6" ),
21- reason = "Scrapy>=2.6 uses argparse"
22- )
23- def test_optparse (command ):
24- parser = OptionParser ()
25- command .add_options (parser )
26- options = parser .parse_args (["--debug" ])
27- assert options [0 ].debug
28-
29-
30- @pytest .mark .skipif (
31- version .parse (scrapy .__version__ ) < version .parse ("2.6" ),
32- reason = "Scrapy<2.6 uses optparse"
33- )
3417def test_argparse (command ):
3518 parser = ArgumentParser ()
3619 command .add_options (parser )
You can’t perform that action at this time.
0 commit comments