As of Pyramid 1.8, we use py.test in the tutorials, scaffolds,
and cookiecutters.
https://github.com/Pylons/pyramid/search?utf8=%E2%9C%93&q=pytest
But that's just the test runner, and doesn't address the core
matter you bring up.
Switching from the setup/teardown to pytest fixtures would be a
tremendous undertaking. As with any unsponsored open source
project, it would happen at the speed of volunteers, and would
necessitate buy in from the core maintainers and experienced
developers. I'd be interested in hearing more, both for and
against, about a switch.
--steve
On 1/26/17 at 7:27 AM, [email protected] (Roman Suzi) pronounced:
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.
------------------------
Steve Piercy, Soquel, CA
--
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/r473Ps-10122i-69AD82F34B814C59AC3A361D0A5D8883%40Steves-iMac.local.
For more options, visit https://groups.google.com/d/optout.