I do not know what is so hard about tests in Pyramid. Recently wrote all kinds of tests in Flask (completely new framework for me), and with pytest it is a dream: pytest fixtures and their combination is very intuitive compared to the classic approach (with setup/teardown methods), I was able to with just a little googling to do selenium, requests-level, database, etc.
Compared to my Pyramid experience: http://stackoverflow.com/questions/33776475/setting-up-pyramid-1-5-testing-the-right-way I think, it's maybe time to rethink pyramid tutorial with pytest in mind, and provide a tool set (examples of fixtures) in addition to whole example? Regards, Roman On Thu, Jan 26, 2017 at 12:29 AM, Jonathan Vanasco <[email protected]> wrote: > > > On Tuesday, January 24, 2017 at 4:50:55 PM UTC-5, Steve Piercy wrote: >> >> Take a look at this step in the SQLAlchemy + URL Dispatch wiki tutorial. >> http://docs.pylonsproject.org/projects/pyramid/en/latest/tut >> orials/wiki2/tests.html > > > +1 for that tutorial. one of the projects we opensourced used that as > inspiration. > > a general pattern I used for those type of tests is: > > 1. insert objects into database via http tests > 2. check objects exist in database via raw sqlalchemy > > in terms of datastores, I suggest using a different connection string for > sqalalchemy -- test against a testdb (i would not test against sqlite if > you're deploying on postgres/mysql as things can differ slightly) > > > at some point your functional tests will work better as part of integrated > tests... at that point, i like using the `requests` library to work like a > headless browser. beautfifulsoup can help ensure you have the right > content on the page. > > it can take a little longer to write, but I found that `requests` worked > significantly faster than selenium (as in "seconds instead of minutes", and > one 26+ minute selenium test dropped to around 90 seconds when it was > rewritten to requests.) > > -- > 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]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/pylons-discuss/9cdded60-72af-4345-81b3-b5bfdf47c250% > 40googlegroups.com > <https://groups.google.com/d/msgid/pylons-discuss/9cdded60-72af-4345-81b3-b5bfdf47c250%40googlegroups.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- 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]. To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/CAGMtdKet4aNDKH4ahr1wyVW1Ku5T1SWvFd5PoCBjD8BLHYhwiQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
