From cdent at anticdent.org Mon Jul 1 07:07:27 2019 From: cdent at anticdent.org (Chris Dent) Date: Mon, 1 Jul 2019 12:07:27 +0100 (BST) Subject: [pytest-dev] pytest 5.0.0 and pluginmanager Message-ID: I maintain gabbi [1], a YAML driven HTTP API tester that dynamically creates test cases in ordered suites. It was originally created to work in a unittest/testtools/testrepository environment and then had pytest support hacked in later. It does some shall we say unorthodox things to work in both environments without requiring too much manipulation or boilerplate from the person creating the tests. One of those things is the use of late import of pytest and loading of plugin to structure the tests: https://github.com/cdent/gabbi/blob/149e046bd0bd42d283e4771c820fbae90273f4fb/gabbi/driver.py#L162-L164 That uses the now deprecated `pytest.config` global and I'm struggling to determine how best to replace it without having to make changes to the calling patterns that would break compatibility with existing test installations. This is the second implementation of gabbi+pytest. The first one used yield tests (for which I gained a strong affection long ago). The second was created to be compatible with existing deployed tests. Now I find myself needing to adapt things again. If I can continue to be compatible that would be great. Any ideas? [1] https://gabbi.readthedocs.io/ and https://github.com/cdent/gabbi -- Chris Dent ????? https://anticdent.org/ freenode: cdent From nicoddemus at gmail.com Mon Jul 1 07:38:43 2019 From: nicoddemus at gmail.com (Bruno Oliveira) Date: Mon, 1 Jul 2019 08:38:43 -0300 Subject: [pytest-dev] pytest 5.0.0 and pluginmanager In-Reply-To: References: Message-ID: Hi Chris, On Mon, Jul 1, 2019 at 8:17 AM Chris Dent wrote: > > That uses the now deprecated `pytest.config` global and I'm > struggling to determine how best to replace it without having to > make changes to the calling patterns that would break compatibility > with existing test installations. > Is Gabbi + pytest a plugin? If so, you could store the config object during pytest_configure to reuse later: ``` _gabbi_pytest_config = None def pytest_configure(config): global _gabbi_pytest_config _gabbi_pytest_config = config def pytest_unconfigure(): global _gabbi_pytest_config _gabbi_pytest_config = None ``` This is basically what pytest did to provide the pytest.config global. This is more elegant if you can register this in a class of course. If you don't have a proper plugin, it is easy to write a small one even if only to get that global. > This is the second implementation of gabbi+pytest. The first one > used yield tests (for which I gained a strong affection long ago). > The second was created to be compatible with existing deployed > tests. Now I find myself needing to adapt things again. If I can > continue to be compatible that would be great. > It should definitely be possible, with minimal effort. Let us know if we can help further. Cheers, Bruno; -------------- next part -------------- An HTML attachment was scrubbed... URL: From cdent at anticdent.org Mon Jul 1 08:21:17 2019 From: cdent at anticdent.org (Chris Dent) Date: Mon, 1 Jul 2019 13:21:17 +0100 (BST) Subject: [pytest-dev] pytest 5.0.0 and pluginmanager In-Reply-To: References: Message-ID: On Mon, 1 Jul 2019, Bruno Oliveira wrote: > On Mon, Jul 1, 2019 at 8:17 AM Chris Dent wrote: > Is Gabbi + pytest a plugin? If so, you could store the config object during > pytest_configure to reuse later: Thanks for the quick response. It's sort of a plugin. It uses plugin mechanisms to manage the collection process and manage fixtures that are scoped over a sequence of tests (instead of just one test). The issue is that in the deployed tests already using gabbi, there is no conftest.py nor python test file that is fully "pytest aware" from which to load the plugin. Instead the test file calls a function which itself loads pytest and then loads the plugin: import pytest pluginmanager = pytest.config.pluginmanager pluginmanager.import_plugin('gabbi.pytester') Messing about just now I see that I've got access to a metafunc and it has a `config` so this seems to be working: if metafunc: pluginmanager = metafunc.config.pluginmanager else: import pytest pluginmanager = pytest.config.pluginmanager (There are older calling scenarios where metafunc will be None.) Is this a suitable workaround or am I opening myself up for future trouble by doing this? Ideally, I would make gabbi+pytest be a proper plugin, but resources for doing that work have been tight of late and it would mean a major version bump which I'm reluctant to do until I have solutions to other large issues in mind. -- Chris Dent ????? https://anticdent.org/ freenode: cdent From nicoddemus at gmail.com Mon Jul 1 08:35:03 2019 From: nicoddemus at gmail.com (Bruno Oliveira) Date: Mon, 1 Jul 2019 09:35:03 -0300 Subject: [pytest-dev] pytest 5.0.0 and pluginmanager In-Reply-To: References: Message-ID: On Mon, Jul 1, 2019 at 9:21 AM Chris Dent wrote: > On Mon, 1 Jul 2019, Bruno Oliveira wrote: > > On Mon, Jul 1, 2019 at 8:17 AM Chris Dent wrote: > > Is Gabbi + pytest a plugin? If so, you could store the config object > during > > pytest_configure to reuse later: > > Thanks for the quick response. > > It's sort of a plugin. It uses plugin mechanisms to manage the > collection process and manage fixtures that are scoped over a > sequence of tests (instead of just one test). > > The issue is that in the deployed tests already using gabbi, > there is no conftest.py nor python test file that is fully > "pytest aware" from which to load the plugin. Instead the test > file calls a function which itself loads pytest and then loads > the plugin: > > import pytest > pluginmanager = pytest.config.pluginmanager > pluginmanager.import_plugin('gabbi.pytester') > Hmmm strange, because for "pytest.config" to be available, it means the user is running the "pytest" command. You can see here how pytest used to do it: https://github.com/pytest-dev/pytest/blob/d3549df5b94137453b832345a9b8074f518731b0/src/_pytest/main.py#L191-L192 (It is inserting a wrapper object to issue a warning, but other than that the mechanism is there) So in theory your plugin is running under pytest, otherwise `pytest.config` would raise an AttributeError. Messing about just now I see that I've got access to a metafunc and > it has a `config` so this seems to be working: > > if metafunc: > pluginmanager = metafunc.config.pluginmanager > else: > import pytest > pluginmanager = pytest.config.pluginmanager > > (There are older calling scenarios where metafunc will be None.) > > Is this a suitable workaround or am I opening myself up for future > trouble by doing this? > We don't have any plans to deprecate `metafunc.config`, as doing so would break *tons* of code, and is really part of the API and no great downsides (as opposed to the pytest.config which was a nasty global). If you can't make the "pytest_configure" suggestion work, this seems OK to me. Cheers, Bruno -------------- next part -------------- An HTML attachment was scrubbed... URL: From cdent at anticdent.org Mon Jul 1 08:42:39 2019 From: cdent at anticdent.org (Chris Dent) Date: Mon, 1 Jul 2019 13:42:39 +0100 (BST) Subject: [pytest-dev] pytest 5.0.0 and pluginmanager In-Reply-To: References: Message-ID: On Mon, 1 Jul 2019, Bruno Oliveira wrote: > Hmmm strange, because for "pytest.config" to be available, it means the > user is running the "pytest" command. Yes, they are, but in the package within which the tests are created and loaded, pytest_configure is not called because it is not a test nor plugin itself and I don't want to require the user to have a pytest_configure themselves. As I said before: it's messy... :) > We don't have any plans to deprecate `metafunc.config`, as doing so would > break *tons* of code, and is really part of the API and no great downsides > (as opposed to the pytest.config which was a nasty global). > > If you can't make the "pytest_configure" suggestion work, this seems OK to > me. Thanks, I think I'll go with the metafunc way for now, since it keeps the existing things working as expected. If I ever find some additional time, or people who are interested, I can try to do the work that will make the test generation my pytest-oriented, rather than the messy hack it is now. -- Chris Dent ????? https://anticdent.org/ freenode: cdent From me at the-compiler.org Wed Jul 3 08:54:31 2019 From: me at the-compiler.org (Florian Bruhin) Date: Wed, 3 Jul 2019 14:54:31 +0200 Subject: [pytest-dev] Upcoming pytest trainings in Switzerland Message-ID: <20190703125431.wu3m44z2uuyd7nbl@hooch.localdomain> Hi! I'm happy to announce that I'll give two open pytest trainings in Switzerland: At Europython 2019, 8th July in Basel: https://ep2019.europython.eu/talks/94WEnsY-introduction-to-pytest/ At Workshoptage 2019 (in German), 10th October in Rapperswil: https://workshoptage.ch/workshops/2019/test-driven-development-fuer-python-mit-pytest/ Also, there's more pytest-related content at Europython: Advanced pytest by Raphael Pierzina https://ep2019.europython.eu/talks/4Qchct7-advanced-pytest/ Delta Chat, CFFI, pytest and all the Rust by Holger Krekel https://ep2019.europython.eu/talks/A4mT52r-delta-chat-cffi-pytest-and-all-the-rust/ The pytest/tox/devpi help desk by Oliver Bestwalter https://ep2019.europython.eu/talks/sGMRmxp-the-pytesttoxdevpi-help-desk/ I hope to see some of you there - feel free to say hi! :) Florian -- https://www.qutebrowser.org | me at the-compiler.org (Mail/XMPP) GPG: 916E B0C8 FD55 A072 | https://the-compiler.org/pubkey.asc I love long mails! | https://email.is-not-s.ms/ -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: From nicoddemus at gmail.com Fri Jul 5 07:15:45 2019 From: nicoddemus at gmail.com (Bruno Oliveira) Date: Fri, 5 Jul 2019 08:15:45 -0300 Subject: [pytest-dev] pytest 5.0.1 Message-ID: pytest 5.0.1 has just been released to PyPI. This is a bug-fix release, being a drop-in replacement. To upgrade:: pip install --upgrade pytest The full changelog is available at https://docs.pytest.org/en/latest/changelog.html. Thanks to all who contributed to this release, among them: * AmirElkess * Andreu Vallbona Plazas * Anthony Sottile * Bruno Oliveira * Florian Bruhin * Michael Moore * Niklas Meinzer * Thomas Grainger Happy testing, The pytest Development Team -------------- next part -------------- An HTML attachment was scrubbed... URL: From sylvain.marie at se.com Sat Jul 6 04:49:05 2019 From: sylvain.marie at se.com (Sylvain MARIE) Date: Sat, 6 Jul 2019 08:49:05 +0000 Subject: [pytest-dev] Upcoming pytest trainings in Switzerland In-Reply-To: <20190703125431.wu3m44z2uuyd7nbl@hooch.localdomain> References: <20190703125431.wu3m44z2uuyd7nbl@hooch.localdomain> Message-ID: Hi Florian Thanks for the invite ! I saw these talks in the track listing but unfortunately discovered the existence of the whole event a bit late (shame on me), and could not adapt my (industrial) workplan. That's sad because I would really have wanted to get "real" feedback on the topic of "fixture unions" https://github.com/pytest-dev/pytest/issues/349#issuecomment-501796965 , to see if it could be considered a viable feature for a future release. Anyway, happy Europython then ! Oh and by the way since I am lucky enough that you read til' here, a little advertisement for my latest "tiny but useful" package : https://smarie.github.io/python-getversion/ Happy summer everyone (of code, or not ;-) ) Kind regards Sylvain -----Message d'origine----- De?: pytest-dev De la part de Florian Bruhin Envoy??: mercredi 3 juillet 2019 14:55 ??: pytest-dev at python.org; testing-in-python at lists.idyll.org Objet?: [pytest-dev] Upcoming pytest trainings in Switzerland [External email: Use caution with links and attachments] ________________________________ Hi! I'm happy to announce that I'll give two open pytest trainings in Switzerland: At Europython 2019, 8th July in Basel: https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fep2019.europython.eu%2Ftalks%2F94WEnsY-introduction-to-pytest%2F&data=02%7C01%7Csylvain.marie%40se.com%7Cee7998edcafb40ceccdc08d6ffb59efc%7C6e51e1adc54b4b39b5980ffe9ae68fef%7C0%7C0%7C636977552860520312&sdata=bdTkFUi1kXhEVgkK0VZm5jbPuHxmxwBDGjAWyePWFlc%3D&reserved=0 At Workshoptage 2019 (in German), 10th October in Rapperswil: https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fworkshoptage.ch%2Fworkshops%2F2019%2Ftest-driven-development-fuer-python-mit-pytest%2F&data=02%7C01%7Csylvain.marie%40se.com%7Cee7998edcafb40ceccdc08d6ffb59efc%7C6e51e1adc54b4b39b5980ffe9ae68fef%7C0%7C0%7C636977552860520312&sdata=umKJ3OO5NcRMEfulYMrxYzpEuyO30a9N4CeaJ5Mso%2FE%3D&reserved=0 Also, there's more pytest-related content at Europython: Advanced pytest by Raphael Pierzina https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fep2019.europython.eu%2Ftalks%2F4Qchct7-advanced-pytest%2F&data=02%7C01%7Csylvain.marie%40se.com%7Cee7998edcafb40ceccdc08d6ffb59efc%7C6e51e1adc54b4b39b5980ffe9ae68fef%7C0%7C0%7C636977552860520312&sdata=yesFJrbEmVrCBLcmWJe1Vr2pFUNIbOnVn5vqxLHcllQ%3D&reserved=0 Delta Chat, CFFI, pytest and all the Rust by Holger Krekel https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fep2019.europython.eu%2Ftalks%2FA4mT52r-delta-chat-cffi-pytest-and-all-the-rust%2F&data=02%7C01%7Csylvain.marie%40se.com%7Cee7998edcafb40ceccdc08d6ffb59efc%7C6e51e1adc54b4b39b5980ffe9ae68fef%7C0%7C0%7C636977552860520312&sdata=Mnv%2FlD7f1yTHApVXQWjjTEKpytsqHeDmyn1T2mLlj4g%3D&reserved=0 The pytest/tox/devpi help desk by Oliver Bestwalter https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fep2019.europython.eu%2Ftalks%2FsGMRmxp-the-pytesttoxdevpi-help-desk%2F&data=02%7C01%7Csylvain.marie%40se.com%7Cee7998edcafb40ceccdc08d6ffb59efc%7C6e51e1adc54b4b39b5980ffe9ae68fef%7C0%7C0%7C636977552860520312&sdata=h13OTOEdY7kW%2FOCO6OJGZ7YyrVQnvgeCP7IFXtbWdnM%3D&reserved=0 I hope to see some of you there - feel free to say hi! :) Florian -- https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.qutebrowser.org&data=02%7C01%7Csylvain.marie%40se.com%7Cee7998edcafb40ceccdc08d6ffb59efc%7C6e51e1adc54b4b39b5980ffe9ae68fef%7C0%7C0%7C636977552860520312&sdata=Di4ZeUuBJeOniCTGU27kPF01ul2BWcAPAy%2Bskr09vcU%3D&reserved=0 | me at the-compiler.org (Mail/XMPP) GPG: 916E B0C8 FD55 A072 | https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fthe-compiler.org%2Fpubkey.asc&data=02%7C01%7Csylvain.marie%40se.com%7Cee7998edcafb40ceccdc08d6ffb59efc%7C6e51e1adc54b4b39b5980ffe9ae68fef%7C0%7C0%7C636977552860530310&sdata=QRJqxtDS1gc2607hAkkDAohjqPkjz4fE3tSh%2BvkpfEY%3D&reserved=0 I love long mails! | https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Femail.is-not-s.ms%2F&data=02%7C01%7Csylvain.marie%40se.com%7Cee7998edcafb40ceccdc08d6ffb59efc%7C6e51e1adc54b4b39b5980ffe9ae68fef%7C0%7C0%7C636977552860530310&sdata=EzuEPvJ10QPsJPOLk%2BvqTgOozwLeVoWPMROlpbM8wNY%3D&reserved=0 ______________________________________________________________________ This email has been scanned by the Symantec Email Security.cloud service. ______________________________________________________________________ From reece at harts.net Mon Jul 8 21:34:20 2019 From: reece at harts.net (Reece Hart) Date: Mon, 8 Jul 2019 18:34:20 -0700 Subject: [pytest-dev] Feedback requested on new plugin Message-ID: I would appreciate feedback/code review on a pytest plugin (my first!) that I wrote today to simplify the use of pytest markers for optional tests. Code is at https://github.com/reece/pytest-optional-tests. tests and pypi deployments (via travis) are already available. I'm open to all comments: utility, clarity of terms, and certainly implementation. Comments preferred via github, but on this list is okay too. Thanks, Reece -------------- next part -------------- An HTML attachment was scrubbed... URL: From jimbrannlund at fastmail.com Tue Jul 9 19:19:42 2019 From: jimbrannlund at fastmail.com (=?UTF-8?Q?Jim_Br=C3=A4nnlund?=) Date: Wed, 10 Jul 2019 01:19:42 +0200 Subject: [pytest-dev] Feedback requested on new plugin In-Reply-To: References: Message-ID: <73dcf64b-4348-4d8d-a8db-834f49de96aa@www.fastmail.com> Nice! It looks similar to something that I did a while back: https://github.com/Projectplace/pytest-tags -- Jim Br?nnlund jimbrannlund at fastmail.com On Tue, Jul 9, 2019, at 3:35 AM, Reece Hart wrote: > I would appreciate feedback/code review on a pytest plugin (my first!) that I wrote today to simplify the use of pytest markers for optional tests. Code is at https://github.com/reece/pytest-optional-tests. tests and pypi deployments (via travis) are already available. > > I'm open to all comments: utility, clarity of terms, and certainly implementation. Comments preferred via github, but on this list is okay too. > > Thanks, > Reece > _______________________________________________ > pytest-dev mailing list > pytest-dev at python.org > https://mail.python.org/mailman/listinfo/pytest-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: From arseny.antonov at gmail.com Wed Jul 10 11:46:21 2019 From: arseny.antonov at gmail.com (Arseniy Antonov) Date: Wed, 10 Jul 2019 18:46:21 +0300 Subject: [pytest-dev] Feedback requested on new plugin In-Reply-To: <73dcf64b-4348-4d8d-a8db-834f49de96aa@www.fastmail.com> References: <73dcf64b-4348-4d8d-a8db-834f49de96aa@www.fastmail.com> Message-ID: Hello, Why don't you want to add markers to pytest.ini config? For now, you can add custom run options to the pytest.ini file. [pytest]addopts = -m my_marker But I agree that separate option for run marked tests would be better. [pytest]addopts = -s -v markers_to_run = my_marker1, my_marker2 ??, 10 ???. 2019 ?. ? 02:19, Jim Br?nnlund : > Nice! > > It looks similar to something that I did a while back: > https://github.com/Projectplace/pytest-tags > > -- > Jim Br?nnlund > jimbrannlund at fastmail.com > > > > On Tue, Jul 9, 2019, at 3:35 AM, Reece Hart wrote: > > I would appreciate feedback/code review on a pytest plugin (my first!) > that I wrote today to simplify the use of pytest markers for optional > tests. Code is at https://github.com/reece/pytest-optional-tests. tests > and pypi deployments (via travis) are already available. > > I'm open to all comments: utility, clarity of terms, and certainly > implementation. Comments preferred via github, but on this list is okay too. > > Thanks, > Reece > _______________________________________________ > pytest-dev mailing list > pytest-dev at python.org > https://mail.python.org/mailman/listinfo/pytest-dev > > > _______________________________________________ > pytest-dev mailing list > pytest-dev at python.org > https://mail.python.org/mailman/listinfo/pytest-dev > -- -------------------------- Regards. Arseny Antonov -------------- next part -------------- An HTML attachment was scrubbed... URL: From reece at harts.net Wed Jul 10 18:14:17 2019 From: reece at harts.net (Reece Hart) Date: Wed, 10 Jul 2019 18:14:17 -0400 Subject: [pytest-dev] Feedback requested on new plugin In-Reply-To: References: <73dcf64b-4348-4d8d-a8db-834f49de96aa@www.fastmail.com> Message-ID: Jim- Interesting. Definitely related. Thanks for sharing that. Arseniy- The major motivation is to disable certain tests by default. I tried to outline the shortcomings of current mechanisms in the README, but probably need a bit more. In any case, using -m expressions in the cfg file conflicts with using them on the command line. Also, it's a bit unwieldy if you want to disable tests for multiple markers. -Reece On Wed, Jul 10, 2019 at 11:46 AM Arseniy Antonov wrote: > Hello, > Why don't you want to add markers to pytest.ini config? > For now, you can add custom run options to the pytest.ini file. > > [pytest]addopts = -m my_marker > > But I agree that separate option for run marked tests would be better. > > [pytest]addopts = -s -v > markers_to_run = my_marker1, my_marker2 > > > > ??, 10 ???. 2019 ?. ? 02:19, Jim Br?nnlund : > >> Nice! >> >> It looks similar to something that I did a while back: >> https://github.com/Projectplace/pytest-tags >> >> -- >> Jim Br?nnlund >> jimbrannlund at fastmail.com >> >> >> >> On Tue, Jul 9, 2019, at 3:35 AM, Reece Hart wrote: >> >> I would appreciate feedback/code review on a pytest plugin (my first!) >> that I wrote today to simplify the use of pytest markers for optional >> tests. Code is at https://github.com/reece/pytest-optional-tests. tests >> and pypi deployments (via travis) are already available. >> >> I'm open to all comments: utility, clarity of terms, and certainly >> implementation. Comments preferred via github, but on this list is okay too. >> >> Thanks, >> Reece >> _______________________________________________ >> pytest-dev mailing list >> pytest-dev at python.org >> https://mail.python.org/mailman/listinfo/pytest-dev >> >> >> _______________________________________________ >> pytest-dev mailing list >> pytest-dev at python.org >> https://mail.python.org/mailman/listinfo/pytest-dev >> > > > -- > -------------------------- > Regards. > Arseny Antonov > _______________________________________________ > pytest-dev mailing list > pytest-dev at python.org > https://mail.python.org/mailman/listinfo/pytest-dev > -------------- next part -------------- An HTML attachment was scrubbed... URL: From arseny.antonov at gmail.com Thu Jul 11 02:17:23 2019 From: arseny.antonov at gmail.com (Arseniy Antonov) Date: Thu, 11 Jul 2019 09:17:23 +0300 Subject: [pytest-dev] Feedback requested on new plugin In-Reply-To: References: <73dcf64b-4348-4d8d-a8db-834f49de96aa@www.fastmail.com> Message-ID: I got your point, Reece, but maybe it would be better to extend the pytest default config instead of making the plugin. Anyway, it's a good feature. ? ??, 11 ???. 2019 ?. ? 01:14, Reece Hart : > Jim- Interesting. Definitely related. Thanks for sharing that. > > Arseniy- The major motivation is to disable certain tests by default. I > tried to outline the shortcomings of current mechanisms in the README, but > probably need a bit more. In any case, using -m expressions in the cfg file > conflicts with using them on the command line. Also, it's a bit unwieldy if > you want to disable tests for multiple markers. > > -Reece > > > On Wed, Jul 10, 2019 at 11:46 AM Arseniy Antonov > wrote: > >> Hello, >> Why don't you want to add markers to pytest.ini config? >> For now, you can add custom run options to the pytest.ini file. >> >> [pytest]addopts = -m my_marker >> >> But I agree that separate option for run marked tests would be better. >> >> [pytest]addopts = -s -v >> markers_to_run = my_marker1, my_marker2 >> >> >> >> ??, 10 ???. 2019 ?. ? 02:19, Jim Br?nnlund : >> >>> Nice! >>> >>> It looks similar to something that I did a while back: >>> https://github.com/Projectplace/pytest-tags >>> >>> -- >>> Jim Br?nnlund >>> jimbrannlund at fastmail.com >>> >>> >>> >>> On Tue, Jul 9, 2019, at 3:35 AM, Reece Hart wrote: >>> >>> I would appreciate feedback/code review on a pytest plugin (my first!) >>> that I wrote today to simplify the use of pytest markers for optional >>> tests. Code is at https://github.com/reece/pytest-optional-tests. tests >>> and pypi deployments (via travis) are already available. >>> >>> I'm open to all comments: utility, clarity of terms, and certainly >>> implementation. Comments preferred via github, but on this list is okay too. >>> >>> Thanks, >>> Reece >>> _______________________________________________ >>> pytest-dev mailing list >>> pytest-dev at python.org >>> https://mail.python.org/mailman/listinfo/pytest-dev >>> >>> >>> _______________________________________________ >>> pytest-dev mailing list >>> pytest-dev at python.org >>> https://mail.python.org/mailman/listinfo/pytest-dev >>> >> >> >> -- >> -------------------------- >> Regards. >> Arseny Antonov >> _______________________________________________ >> pytest-dev mailing list >> pytest-dev at python.org >> https://mail.python.org/mailman/listinfo/pytest-dev >> > -- -------------------------- Regards. Arseny Antonov -------------- next part -------------- An HTML attachment was scrubbed... URL: From ronny.pfannschmidt at redhat.com Mon Jul 29 04:59:52 2019 From: ronny.pfannschmidt at redhat.com (Ronny Pfannschmidt) Date: Mon, 29 Jul 2019 10:59:52 +0200 Subject: [pytest-dev] enhancing the assertion rewriting experience with custom integration/workflows In-Reply-To: <878t189m79.fsf@powell.devork.be> References: <878t189m79.fsf@powell.devork.be> Message-ID: Hi everyone, i'd like to follow up on this one, as the work project switched from invoking pytest in process to invoking pytest as subprocess, the position/control of the rewriter is no longer a issue. Regards, Ronny On Sun, 2 Dec 2018 at 12:56, Floris Bruynooghe wrote: > Hi Ronny, > > On Thu 29 Nov 2018 at 15:57 +0100, Ronny Pfannschmidt wrote: > > at a project at work which integrates pytest > > we did build a custom workflow around invoking tests and pytest. > > > > This in turn triggers a lot of warnings from the assertion rewriter about > > things that have been already imported. > > > > at first glance fixing this seems rather problematic, as the > configuration > > of the assertion rewriting is deeply bound to the pytest configuration > and > > it seems we cant do something simple and crude like letting a pth file > fix > > the issue. > > > > i believe opening up the hooking system could be best done by moving it > to > > a package with some sort of singleton control anyway - then pytest would > be > > just a consumer of that api enabling if not enabled and push in its own > > "import roots". > > Having the assertion-rewriting in a separate package has been considered > many times already and I can't remember anyone who was actually against > this. I think it's just been waiting for someone to actually really > need it and thus do it and have at least two consumers of the API. > > So do you have any more ideas about what it would look like? As a > random start I think some of these things should be in it: > > - The AST-rewriter. Maybe a little more generalised than the pytest > version, or at least allow for the API to grow in that direction. E.g > customise the code with which the assert statement gets re-written. > > - The import hook. I imagine this would not be installed at all as this > would be up to the user of the package, e.g. pytest. > > I'm not sure if this second part is what you had in mind, since it's > still pytest which would install the import hook. But your problem > description is a bit vague, so I'm not entirely sure what your aim is. > > > Cheers, > Floris > -------------- next part -------------- An HTML attachment was scrubbed... URL: