On Tue, Apr 8, 2014 at 6:56 AM, Andreas Kaiser <[email protected]> wrote: > On 8 Apr 2014, at 15:19, Alexey Kuchm wrote: > >> I've lost my working day trying to setup basic thing: >> >> *Database for unit testing*
It took me a while to set this up too. I don't have the code with me and won't until late next week, but I ended up making some py.test fixtures. In myapp/tests/conftests.py there's: 1. A 'session' fixture initialized by '--db=dburl'. It creates a session without the Zope Transaction Extension, and rolls it back after each test. 2. An 'app' fixture initialized by '--pyramid=test.ini'. I think the command-line parsing is in a separate function that puts the connection in a global variable, so that the 'session' tests will work with either argument, while the 'app' tests require the second. If an argument is missing it will manifest as skipped tests. To figure out why the test was skipped, put '-r s' in the command line. '-s' is also useful to not capture output. (You have to remember that 's' is an argument in the first case, and an option in the second.) '--fixtures' lists the fixtures, but it probably won't list yours unless you're in the tests directory or perhaps if you list the tests in the command line. -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pylons-discuss. For more options, visit https://groups.google.com/d/optout.
