Closed Freed-Wu closed 1 year ago
There are some failing tests. Please make them pass. To run tests on you computer use pytest
.
It seems some test maybe can be changed because optparse and argparse has different behaviours, such as files
, argparse will return
❯ ./trash-put
usage: trash-put [OPTION]... FILE...
trash-put: error: the following arguments are required: files
And the error seem that cannot be changed.
Now pytest has no error in my PC.
Now
❯ ./trash-put
usage: trash-put [OPTION]... FILE...
Please specify the files to trash.
Okay.
python2 cannot support file
for print
?
E print("usage: ", file=sys.stderr, end="")
E ^
E SyntaxError: invalid syntax
How about
sys.stdout = sys.stderr
parser.print_usage()
print("Please specify the files to trash.")
sys.stdout = sys.__stdout__
python2 cannot support
file
forE print("usage: ", file=sys.stderr, end="") E ^ E SyntaxError: invalid syntax
You need to put from __future__ import print_function
at the beginning of python file.
See https://stackoverflow.com/a/9316160/36131
You need to put from future import print_function at the beginning of python file.
OKay.
Don't rebase and/or squash every time you change something. Simply add a new commit. In this way it would be simpler reviewing the latest changes. When all works well and it is ready you can rebase and squash all the commits you want.
Okay.
Now pytest for python3/python2 all can work.
And the get_option_parser is renamed to make_parser. It maybe confuses reviewer. I am sorry. :cry: The code has many pathced_print/patched_error/..., I guess its aim is compatibility of python2? So I keep them.
Ok, now both pytest
and scripts/test-sdist
can work for python 2 and 3.
I cherry-pick the changes about converting optparse to argparse for convenience of review. Thanks.