* Vasily Kuznetsov <[email protected]> [2016-04-28 11:55:48 +0000]: > I was recently writing some tests for a bunch of console scripts. I ended > up having a parametrised function that can run a script for real (using > subprocess.run) or can import its main function, mock the environment and > execute it in the same process (this is much faster).
That's basically what pytest itself does with the pytester/testdir fixture too: https://github.com/pytest-dev/pytest/blob/master/_pytest/pytester.py > I've done similar things before and in general this seems to be a > reasonably common use case. I couldn't find a pytest plugin for testing > console scripts, so I'm wondering if it would be useful to create one. What > do you think? FWIW there's pytest-cram which has a totally different approach, but seemed quite interesting: https://github.com/tbekolay/pytest-cram https://bitheap.org/cram/ Florian -- http://www.the-compiler.org | [email protected] (Mail/XMPP) GPG: 916E B0C8 FD55 A072 | http://the-compiler.org/pubkey.asc I love long mails! | http://email.is-not-s.ms/
signature.asc
Description: Digital signature
_______________________________________________ pytest-dev mailing list [email protected] https://mail.python.org/mailman/listinfo/pytest-dev
