Closed nodiscc closed 6 years ago
https://github.com/shaarli/python-shaarli-client/pull/23/commits/a2a3190212d3feb85fa01f39689779ec61821244 tries to address
printing to console and writing to files should be split over two separate functions, with a bit of logic to process argparse flags in the main() function
Or did you mean something else?
TODO test scenarii: for each supported format:
Hi, sorry for the delay, I think this PR should be in working order now (?).
I will have a look at https://github.com/shaarli/python-shaarli-client/commit/95623f43dbbfbf10d7590cecfc47def9b26b06a8 and try to add the tests you suggested.
Fixed, but at this point I have no idea how to implement the tests, because I see nothing that deals with the program output or files on disk in the current tests...
Pardon my weak Python-fu, if you could point me to a draft test/pseudocode/similar example to do this the right way I could probably start from there
Sure :)
Basically what such tests do is:
This is done by using Pytest's tmpdir fixture, which in turn leverages the py.path high-level filesystem API.
More specifically, tests could cover these functionalities:
format_reponse()
: ensure the output is properly formatted for the available output formatswrite_output()
: ensure the correct exception and message are raised upon a file access errorSuperseded by #31