From holger at merlinux.eu Sun Jul 20 13:08:49 2014 From: holger at merlinux.eu (holger krekel) Date: Sun, 20 Jul 2014 11:08:49 +0000 Subject: [pytest-dev] pytest-2.6: shorter TBs, new warning system, better nose/mock support Message-ID: <20140720110849.GR7481@merlinux.eu> pytest-2.6.0: shorter tracebacks, new warning system, test runner compat =========================================================================== pytest is a mature Python testing tool with more than a 1000 tests against itself, passing on many different interpreters and platforms. The 2.6.0 release should be drop-in backward compatible to 2.5.2 and fixes a number of bugs and brings some new features, mainly: - shorter tracebacks by default: only the first (test function) entry and the last (failure location) entry are shown, the ones between only in "short" format. Use ``--tb=long`` to get back the old behaviour of showing "long" entries everywhere. - a new warning system which reports oddities during collection and execution. For example, ignoring collecting Test* classes with an ``__init__`` now produces a warning. - various improvements to nose/mock/unittest integration Note also that 2.6.0 departs with the "zero reported bugs" policy because it has been too hard to keep up with it, unfortunately. Instead we are for now rather bound to work on "upvoted" issues in the https://bitbucket.org/hpk42/pytest/issues?status=new&status=open&sort=-votes issue tracker. See docs at: http://pytest.org As usual, you can upgrade from pypi via:: pip install -U pytest Thanks to all who contributed, among them: Benjamin Peterson Jurko Gospodneti? Floris Bruynooghe Marc Abramowitz Marc Schlaich Trevor Bekolay Bruno Oliveira Alex Groenholm have fun, holger krekel 2.6.0 ----------------------------------- - fix issue537: Avoid importing old assertion reinterpretation code by default. Thanks Benjamin Peterson. - fix issue364: shorten and enhance tracebacks representation by default. The new "--tb=auto" option (default) will only display long tracebacks for the first and last entry. You can get the old behaviour of printing all entries as long entries with "--tb=long". Also short entries by default are now printed very similarly to "--tb=native" ones. - fix issue514: teach assertion reinterpretation about private class attributes Thanks Benjamin Peterson. - change -v output to include full node IDs of tests. Users can copy a node ID from a test run, including line number, and use it as a positional argument in order to run only a single test. - fix issue 475: fail early and comprehensible if calling pytest.raises with wrong exception type. - fix issue516: tell in getting-started about current dependencies. - cleanup setup.py a bit and specify supported versions. Thanks Jurko Gospodnetic for the PR. - change XPASS colour to yellow rather then red when tests are run with -v. - fix issue473: work around mock putting an unbound method into a class dict when double-patching. - fix issue498: if a fixture finalizer fails, make sure that the fixture is still invalidated. - fix issue453: the result of the pytest_assertrepr_compare hook now gets it's newlines escaped so that format_exception does not blow up. - internal new warning system: pytest will now produce warnings when it detects oddities in your test collection or execution. Warnings are ultimately sent to a new pytest_logwarning hook which is currently only implemented by the terminal plugin which displays warnings in the summary line and shows more details when -rw (report on warnings) is specified. - change skips into warnings for test classes with an __init__ and callables in test modules which look like a test but are not functions. - fix issue436: improved finding of initial conftest files from command line arguments by using the result of parse_known_args rather than the previous flaky heuristics. Thanks Marc Abramowitz for tests and initial fixing approaches in this area. - fix issue #479: properly handle nose/unittest(2) SkipTest exceptions during collection/loading of test modules. Thanks to Marc Schlaich for the complete PR. - fix issue490: include pytest_load_initial_conftests in documentation and improve docstring. - fix issue472: clarify that ``pytest.config.getvalue()`` cannot work if it's triggered ahead of command line parsing. - merge PR123: improved integration with mock.patch decorator on tests. - fix issue412: messing with stdout/stderr FD-level streams is now captured without crashes. - fix issue483: trial/py33 works now properly. Thanks Daniel Grana for PR. - improve example for pytest integration with "python setup.py test" which now has a generic "-a" or "--pytest-args" option where you can pass additional options as a quoted string. Thanks Trevor Bekolay. - simplified internal capturing mechanism and made it more robust against tests or setups changing FD1/FD2, also better integrated now with pytest.pdb() in single tests. - improvements to pytest's own test-suite leakage detection, courtesy of PRs from Marc Abramowitz - fix issue492: avoid leak in test_writeorg. Thanks Marc Abramowitz. - fix issue493: don't run tests in doc directory with ``python setup.py test`` (use tox -e doctesting for that) - fix issue486: better reporting and handling of early conftest loading failures - some cleanup and simplification of internal conftest handling. - work a bit harder to break reference cycles when catching exceptions. Thanks Jurko Gospodnetic. - fix issue443: fix skip examples to use proper comparison. Thanks Alex Groenholm. - support nose-style ``__test__`` attribute on modules, classes and functions, including unittest-style Classes. If set to False, the test will not be collected. - fix issue512: show "" for arguments which might not be set in monkeypatch plugin. Improves output in documentation. - avoid importing "py.test" (an old alias module for "pytest") From nicoddemus at gmail.com Thu Jul 24 00:52:29 2014 From: nicoddemus at gmail.com (Bruno Oliveira) Date: Wed, 23 Jul 2014 19:52:29 -0300 Subject: [pytest-dev] `pytest.main()` frozen by cx_freeze Message-ID: Hi everyone, I'm having trouble getting "pytest.main()" to run inside a frozen script created by cx_freeze (12-line source code here: https://gist.github.com/nicoddemus/5458ca3fc5241cedaff3); when I run the generated executable (I'm on windows), I get this exception: Traceback (most recent call last): File "X:\pytest_cx_freeze\.env27\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in exec(code, m.__dict__) File "runtests.py", line 1, in import pytest, sys File "X:\pytest_cx_freeze\.env27\lib\site-packages\pytest.py", line 14, in from _pytest.config import main, UsageError, _preloadplugins, cmdline File "X:\pytest_cx_freeze\.env27\lib\site-packages\_pytest\config.py", line 398, in class MyOptionParser(py.std.argparse.ArgumentParser): File "X:\pytest_cx_freeze\.env27\lib\site-packages\py\_apipkg.py", line 124, in __makeattr result = importobj(modpath, attrname) File "X:\pytest_cx_freeze\.env27\lib\site-packages\py\_apipkg.py", line 47, in importobj module = __import__(modpath, None, None, ['__doc__']) ImportError: No module named _std I have tried to explicitly import "py._std" on my script, but it also fails: File "X:\pytest_cx_freeze\.env27\lib\site-packages\_pytest\config.py", line 398, in class MyOptionParser(py.std.argparse.ArgumentParser): File "X:\pytest_cx_freeze\.env27\lib\site-packages\py\_std.py", line 15, in __getattr__ raise AttributeError("py.std: could not import %s" % name) AttributeError: py.std: could not import argparse Looks like py's lazy import machinery can't be tracked by cx_freeze. A google search didn't reveal anything useful so for far, unfortunately. Any thoughts? Long story for those interested: we package our desktop applications as executables for both windows and linux using cx_freeze. Traditionally, we also pack the test runner into the executable in order to run the test suite using the packed code, with the test runner being activated by a `--selftest` flag. This ensures everything the application needs to run is correctly packed into the executable, and also enables us to write test scripts and hand them over to customers to run on their site in order to track a bug or to test something out. Best Regards, Bruno. -------------- next part -------------- An HTML attachment was scrubbed... URL: From holger at merlinux.eu Thu Jul 24 16:36:17 2014 From: holger at merlinux.eu (holger krekel) Date: Thu, 24 Jul 2014 14:36:17 +0000 Subject: [pytest-dev] `pytest.main()` frozen by cx_freeze In-Reply-To: References: Message-ID: <20140724143617.GY7481@merlinux.eu> Hi Bruno, i think there are two ways to solve this: - find out how to make py.std work with cx_freeze (haven't looked at that myself yet) - eliminate use of py.std in pytest and maybe py. Personally, I am fine with a PR on that, probably quite straightforward to do. best, Holger On Wed, Jul 23, 2014 at 19:52 -0300, Bruno Oliveira wrote: > Hi everyone, > > I'm having trouble getting "pytest.main()" to run inside a frozen script > created by cx_freeze (12-line source code here: > https://gist.github.com/nicoddemus/5458ca3fc5241cedaff3); when I run the > generated executable (I'm on windows), I get this exception: > > Traceback (most recent call last): > File > "X:\pytest_cx_freeze\.env27\lib\site-packages\cx_Freeze\initscripts\Console.py", > line 27, in > exec(code, m.__dict__) > File "runtests.py", line 1, in > import pytest, sys > File "X:\pytest_cx_freeze\.env27\lib\site-packages\pytest.py", line 14, > in > from _pytest.config import main, UsageError, _preloadplugins, cmdline > File "X:\pytest_cx_freeze\.env27\lib\site-packages\_pytest\config.py", > line 398, in > class MyOptionParser(py.std.argparse.ArgumentParser): > File "X:\pytest_cx_freeze\.env27\lib\site-packages\py\_apipkg.py", line > 124, in __makeattr > result = importobj(modpath, attrname) > File "X:\pytest_cx_freeze\.env27\lib\site-packages\py\_apipkg.py", line > 47, in importobj > module = __import__(modpath, None, None, ['__doc__']) > ImportError: No module named _std > > > > I have tried to explicitly import "py._std" on my script, but it also fails: > > > File "X:\pytest_cx_freeze\.env27\lib\site-packages\_pytest\config.py", > line 398, in > class MyOptionParser(py.std.argparse.ArgumentParser): > File "X:\pytest_cx_freeze\.env27\lib\site-packages\py\_std.py", line 15, > in __getattr__ > raise AttributeError("py.std: could not import %s" % name) > AttributeError: py.std: could not import argparse > > > Looks like py's lazy import machinery can't be tracked by cx_freeze. > > A google search didn't reveal anything useful so for far, unfortunately. > Any thoughts? > > Long story for those interested: we package our desktop applications as > executables for both windows and linux using cx_freeze. Traditionally, we > also pack the test runner into the executable in order to run the > test suite using the packed code, with the test runner being activated by a > `--selftest` flag. This ensures everything the application needs to run is > correctly packed into the executable, and also enables us to write test > scripts and hand them over to customers to run on their site in order to > track a bug or to test something out. > > Best Regards, > Bruno. > _______________________________________________ > Pytest-dev mailing list > Pytest-dev at python.org > https://mail.python.org/mailman/listinfo/pytest-dev From nicoddemus at gmail.com Thu Jul 24 17:24:33 2014 From: nicoddemus at gmail.com (Bruno Oliveira) Date: Thu, 24 Jul 2014 12:24:33 -0300 Subject: [pytest-dev] `pytest.main()` frozen by cx_freeze In-Reply-To: <20140724143617.GY7481@merlinux.eu> References: <20140724143617.GY7481@merlinux.eu> Message-ID: Hi Holger, On Thu, Jul 24, 2014 at 11:36 AM, holger krekel wrote: > i think there are two ways to solve this: > > - find out how to make py.std work with cx_freeze > (haven't looked at that myself yet) > I'm investigating this and will share any findings. - eliminate use of py.std in pytest and maybe py. > Personally, I am fine with a PR on that, probably > quite straightforward to do. > Didn't know that could be an option; I will take a look into it, shouldn't be too complicated. Thanks for the answer! Bruno -------------- next part -------------- An HTML attachment was scrubbed... URL: From bubenkoff at gmail.com Fri Jul 25 21:27:22 2014 From: bubenkoff at gmail.com (Anatoly Bubenkov) Date: Fri, 25 Jul 2014 21:27:22 +0200 Subject: [pytest-dev] collecting pytest plugins on github 'pytest' company Message-ID: Hi all, looking at jenkinsci account on the github i've got an idea to create pytest 'company' github account and ask plugin developer to move plugins under that account This could help to `protect` the plugin development somehow, also will help a lot in terms of the support, as `board` members will be almost everyone who contributes to any plugin, so the community will pay more attention also to plugins, not only to the pytest itself. As for bitbucket, we can do same there (for those plugins which are on bb) What do you think? -- Anatoly Bubenkov -------------- next part -------------- An HTML attachment was scrubbed... URL: From holger at merlinux.eu Sat Jul 26 12:41:48 2014 From: holger at merlinux.eu (holger krekel) Date: Sat, 26 Jul 2014 10:41:48 +0000 Subject: [pytest-dev] collecting pytest plugins on github 'pytest' company In-Reply-To: References: Message-ID: <20140726104148.GD7481@merlinux.eu> On Fri, Jul 25, 2014 at 21:27 +0200, Anatoly Bubenkov wrote: > Hi all, > looking at jenkinsci account on the github i've got an idea to create > pytest 'company' github > account and ask plugin developer to move plugins under that account > This could help to `protect` the plugin development somehow, also will help > a lot in terms of the > support, as `board` members will be almost everyone who contributes to any > plugin, so the community will pay more attention also to plugins, not only > to the pytest itself. > As for bitbucket, we can do same there (for those plugins which are on bb) > What do you think? Sounds good. Am happy to accept a PR on the docs explaining the idea and then you are good to go. (Bitbucket can come later if needed). holger > -- > Anatoly Bubenkov > _______________________________________________ > Pytest-dev mailing list > Pytest-dev at python.org > https://mail.python.org/mailman/listinfo/pytest-dev From harro.vanderklauw at paylogic.com Sat Jul 26 12:57:09 2014 From: harro.vanderklauw at paylogic.com (Harro van der Klauw) Date: Sat, 26 Jul 2014 12:57:09 +0200 Subject: [pytest-dev] collecting pytest plugins on github 'pytest' company In-Reply-To: <20140726104148.GD7481@merlinux.eu> References: <20140726104148.GD7481@merlinux.eu> Message-ID: +1 I think having one place for the plugins is good. If you when need to change something in py.test you can do a quick search through the plugins and see if they will be affected. It will also allow for more collaboration between plugin developers. Harro On 26 July 2014 12:41, holger krekel wrote: > On Fri, Jul 25, 2014 at 21:27 +0200, Anatoly Bubenkov wrote: > > Hi all, > > looking at jenkinsci account on the github i've got an idea to create > > pytest 'company' github > > account and ask plugin developer to move plugins under that account > > This could help to `protect` the plugin development somehow, also will > help > > a lot in terms of the > > support, as `board` members will be almost everyone who contributes to > any > > plugin, so the community will pay more attention also to plugins, not > only > > to the pytest itself. > > As for bitbucket, we can do same there (for those plugins which are on > bb) > > What do you think? > > Sounds good. Am happy to accept a PR on the docs explaining the idea > and then you are good to go. (Bitbucket can come later if needed). > > holger > > > -- > > Anatoly Bubenkov > > > _______________________________________________ > > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicoddemus at gmail.com Sat Jul 26 16:01:32 2014 From: nicoddemus at gmail.com (Bruno Oliveira) Date: Sat, 26 Jul 2014 11:01:32 -0300 Subject: [pytest-dev] collecting pytest plugins on github 'pytest' company In-Reply-To: References: <20140726104148.GD7481@merlinux.eu> Message-ID: +1 Cheers On Sat, Jul 26, 2014 at 7:57 AM, Harro van der Klauw < harro.vanderklauw at paylogic.com> wrote: > +1 > > I think having one place for the plugins is good. If you when need to > change something in py.test you can do a quick search through the plugins > and see if they will be affected. > > It will also allow for more collaboration between plugin developers. > > Harro > > > > On 26 July 2014 12:41, holger krekel wrote: > >> On Fri, Jul 25, 2014 at 21:27 +0200, Anatoly Bubenkov wrote: >> > Hi all, >> > looking at jenkinsci account on the github i've got an idea to create >> > pytest 'company' github >> > account and ask plugin developer to move plugins under that account >> > This could help to `protect` the plugin development somehow, also will >> help >> > a lot in terms of the >> > support, as `board` members will be almost everyone who contributes to >> any >> > plugin, so the community will pay more attention also to plugins, not >> only >> > to the pytest itself. >> > As for bitbucket, we can do same there (for those plugins which are on >> bb) >> > What do you think? >> >> Sounds good. Am happy to accept a PR on the docs explaining the idea >> and then you are good to go. (Bitbucket can come later if needed). >> >> holger >> >> > -- >> > Anatoly Bubenkov >> >> > _______________________________________________ >> > 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 >> > > > _______________________________________________ > 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 bubenkoff at gmail.com Sat Jul 26 13:38:07 2014 From: bubenkoff at gmail.com (Anatoly Bubenkov) Date: Sat, 26 Jul 2014 13:38:07 +0200 Subject: [pytest-dev] collecting pytest plugins on github 'pytest' company In-Reply-To: <20140726104148.GD7481@merlinux.eu> References: <20140726104148.GD7481@merlinux.eu> Message-ID: challenge accepted :) On 26 July 2014 12:41, holger krekel wrote: > On Fri, Jul 25, 2014 at 21:27 +0200, Anatoly Bubenkov wrote: > > Hi all, > > looking at jenkinsci account on the github i've got an idea to create > > pytest 'company' github > > account and ask plugin developer to move plugins under that account > > This could help to `protect` the plugin development somehow, also will > help > > a lot in terms of the > > support, as `board` members will be almost everyone who contributes to > any > > plugin, so the community will pay more attention also to plugins, not > only > > to the pytest itself. > > As for bitbucket, we can do same there (for those plugins which are on > bb) > > What do you think? > > Sounds good. Am happy to accept a PR on the docs explaining the idea > and then you are good to go. (Bitbucket can come later if needed). > > holger > > > -- > > Anatoly Bubenkov > > > _______________________________________________ > > Pytest-dev mailing list > > Pytest-dev at python.org > > https://mail.python.org/mailman/listinfo/pytest-dev > > -- Anatoly Bubenkov -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicoddemus at gmail.com Sun Jul 27 05:57:52 2014 From: nicoddemus at gmail.com (Bruno Oliveira) Date: Sun, 27 Jul 2014 00:57:52 -0300 Subject: [pytest-dev] `pytest.main()` frozen by cx_freeze In-Reply-To: References: <20140724143617.GY7481@merlinux.eu> Message-ID: Hi all, I managed to get it to work by explicitly importing pytest and py modules explicitly. The version that worked for me is in the same gist link I sent earlier (https://gist.github.com/nicoddemus/5458ca3fc5241cedaff3), which I made public so others that run into the same problem can find it. Also created a PR that eliminates py.std use from pytest, although I could get the frozen executable to work without needing that after all. Just went ahead with the PR because Holger showed interest on it. :) Cheers, On Thu, Jul 24, 2014 at 12:24 PM, Bruno Oliveira wrote: > Hi Holger, > > On Thu, Jul 24, 2014 at 11:36 AM, holger krekel > wrote: > >> i think there are two ways to solve this: >> >> - find out how to make py.std work with cx_freeze >> (haven't looked at that myself yet) >> > > I'm investigating this and will share any findings. > > - eliminate use of py.std in pytest and maybe py. >> Personally, I am fine with a PR on that, probably >> quite straightforward to do. >> > > Didn't know that could be an option; I will take a look into it, shouldn't > be too complicated. > > Thanks for the answer! > > Bruno > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bubenkoff at gmail.com Mon Jul 28 14:22:40 2014 From: bubenkoff at gmail.com (Anatoly Bubenkov) Date: Mon, 28 Jul 2014 14:22:40 +0200 Subject: [pytest-dev] pytest github organization is taken Message-ID: Hi all if it was you who created this org https://github.com/pytest please make Holger an admin if this name was taken by someone who's not related to pytest in any way, then we should make a claim to github to get the rights i guess the org is empty and created Oct 21, 2013 -- Anatoly Bubenkov -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicoddemus at gmail.com Tue Jul 29 04:08:42 2014 From: nicoddemus at gmail.com (Bruno Oliveira) Date: Mon, 28 Jul 2014 23:08:42 -0300 Subject: [pytest-dev] `pytest.main()` frozen by cx_freeze In-Reply-To: References: <20140724143617.GY7481@merlinux.eu> Message-ID: Hi all, For future reference, I created a repository with a solution at https://github.com/nicoddemus/cx_freeze_pytest_example. Cheers, On Sun, Jul 27, 2014 at 12:57 AM, Bruno Oliveira wrote: > Hi all, > > I managed to get it to work by explicitly importing pytest and py modules > explicitly. The version that worked for me is in the same gist link I sent > earlier (https://gist.github.com/nicoddemus/5458ca3fc5241cedaff3), which > I made public so others that run into the same problem can find it. > > Also created a PR that eliminates py.std use from pytest, although I could > get the frozen executable to work without needing that after all. Just went > ahead with the PR because Holger showed interest on it. :) > > Cheers, > > > On Thu, Jul 24, 2014 at 12:24 PM, Bruno Oliveira > wrote: > >> Hi Holger, >> >> On Thu, Jul 24, 2014 at 11:36 AM, holger krekel >> wrote: >> >>> i think there are two ways to solve this: >>> >>> - find out how to make py.std work with cx_freeze >>> (haven't looked at that myself yet) >>> >> >> I'm investigating this and will share any findings. >> >> - eliminate use of py.std in pytest and maybe py. >>> Personally, I am fine with a PR on that, probably >>> quite straightforward to do. >>> >> >> Didn't know that could be an option; I will take a look into it, >> shouldn't be too complicated. >> >> Thanks for the answer! >> >> Bruno >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From bubenkoff at gmail.com Tue Jul 29 10:24:30 2014 From: bubenkoff at gmail.com (Anatoly Bubenkov) Date: Tue, 29 Jul 2014 10:24:30 +0200 Subject: [pytest-dev] extended asserts Message-ID: what do you think about extending the existing assert representation with this https://pypi.python.org/pypi/datadiff would be nice if we could extend datadiff with what pytest does for string diff and then just use datadiff for all assertions because for now, it's not too useful to see a comparison of 2 dicts in the pytest it's not readable especially if 2 dicts are big and nowadays, json so dicts are everywhere datadiff is cool at showing the diff between 2 dicts the reason why im asking without the PR is the politics about the dependencies as i know you're not so positive about adding them also this standalone mode is a bit tricky in that case, i guess example: def test_ticket_filter_on_order_uid__in(app, first_ticket, second_ticket, second_basket_ticket, order, second_order): """Test if the right result is returned when filtering on basket.""" ticket_filter = pta.ticket.filter(api_key=app.uid, order_uid__in=[order['uid']]).content > assert ticket_filter == [first_ticket, second_ticket] E assert [{'code': '91...dulum'}, ...}] == [{'basket_uid'... 'EUR'}, ...}] E At index 0 diff: {'code': '911338060856', 'subtitle': {'en': u'Subtitle1 Kaleidoscope'}, 'uid': u'37bc3c15e66a45e9bf3b52233fcdff02', 'order_uid': u'08dec1bd7ec249109729de448ffcc571', 'price': {'currency': 'EUR', 'amount': '1.20'}, 'fees': [{'price': {'currency': 'EUR', 'amount': '2.00'}, 'type': 'service costs'}], 'product_uid': u'32c2a6f98f0642b9843a8dcce6dead56', 'name': {'en': u'Ticket1 \u2603 Weapon'}} != {'subtitle': {'en': u'Subtitle1 Kaleidoscope'}, 'uid': u'37bc3c15e66a45e9bf3b52233fcdff02', 'price': {'currency': 'EUR', 'amount': '1.20'}, 'fees': [{'price': {'currency': 'EUR', 'amount': '2.00'}, 'type': 'service costs'}], 'basket_uid': u'871e829da04e4cd9a45d244f55824c83', 'product_uid': u'32c2a6f98f0642b9843a8dcce6dead56', 'name': {'en': u'Ticket1 \u2603 Weapon'}} just unreadable -- Anatoly Bubenkov -------------- next part -------------- An HTML attachment was scrubbed... URL: From nicoddemus at gmail.com Tue Jul 29 21:46:18 2014 From: nicoddemus at gmail.com (Bruno Oliveira) Date: Tue, 29 Jul 2014 16:46:18 -0300 Subject: [pytest-dev] extended asserts In-Reply-To: References: Message-ID: Hi, Perhaps this could a plugin (pytest-datadiff)? I know you can customize assertion messages for other types (see http://pytest.org/latest/assert.html#defining-your-own-assertion-comparison), but I don't know how that plays with assertions already built in pytest. Cheers, On Tue, Jul 29, 2014 at 5:24 AM, Anatoly Bubenkov wrote: > what do you think about extending the existing assert representation with > this > https://pypi.python.org/pypi/datadiff > would be nice if we could extend datadiff with what pytest does for string > diff > and then just use datadiff for all assertions > because for now, it's not too useful to see a comparison of 2 dicts in the > pytest > it's not readable > especially if 2 dicts are big > and nowadays, json so dicts are everywhere > datadiff is cool at showing the diff between 2 dicts > the reason why im asking without the PR is the politics about the > dependencies > as i know you're not so positive about adding them > also this standalone mode is a bit tricky in that case, i guess > example: > > def test_ticket_filter_on_order_uid__in(app, first_ticket, second_ticket, > second_basket_ticket, order, second_order): > """Test if the right result is returned when filtering on basket.""" > ticket_filter = pta.ticket.filter(api_key=app.uid, > order_uid__in=[order['uid']]).content > > assert ticket_filter == [first_ticket, second_ticket] > E assert [{'code': '91...dulum'}, ...}] == [{'basket_uid'... 'EUR'}, ...}] > E At index 0 diff: {'code': '911338060856', 'subtitle': {'en': u'Subtitle1 > Kaleidoscope'}, 'uid': u'37bc3c15e66a45e9bf3b52233fcdff02', 'order_uid': > u'08dec1bd7ec249109729de448ffcc571', 'price': {'currency': 'EUR', 'amount': > '1.20'}, 'fees': [{'price': {'currency': 'EUR', 'amount': '2.00'}, 'type': > 'service costs'}], 'product_uid': u'32c2a6f98f0642b9843a8dcce6dead56', > 'name': {'en': u'Ticket1 \u2603 Weapon'}} != {'subtitle': {'en': > u'Subtitle1 Kaleidoscope'}, 'uid': u'37bc3c15e66a45e9bf3b52233fcdff02', > 'price': {'currency': 'EUR', 'amount': '1.20'}, 'fees': [{'price': > {'currency': 'EUR', 'amount': '2.00'}, 'type': 'service costs'}], > 'basket_uid': u'871e829da04e4cd9a45d244f55824c83', 'product_uid': > u'32c2a6f98f0642b9843a8dcce6dead56', 'name': {'en': u'Ticket1 \u2603 > Weapon'}} > just unreadable > > > -- > Anatoly Bubenkov > > _______________________________________________ > 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 nicoddemus at gmail.com Tue Jul 29 22:25:04 2014 From: nicoddemus at gmail.com (Bruno Oliveira) Date: Tue, 29 Jul 2014 17:25:04 -0300 Subject: [pytest-dev] extended asserts In-Reply-To: References: Message-ID: Nice, be sure to keep the mailing list informed. :) Cheers, On Tue, Jul 29, 2014 at 5:17 PM, Anatoly Bubenkov wrote: > Yes I'll do it as a separate plugin first > Then we can think about including it in the core > On Jul 29, 2014 9:46 PM, "Bruno Oliveira" wrote: > >> Hi, >> >> Perhaps this could a plugin (pytest-datadiff)? I know you can customize >> assertion messages for other types (see >> http://pytest.org/latest/assert.html#defining-your-own-assertion-comparison), >> but I don't know how that plays with assertions already built in pytest. >> >> Cheers, >> >> >> On Tue, Jul 29, 2014 at 5:24 AM, Anatoly Bubenkov >> wrote: >> >>> what do you think about extending the existing assert representation >>> with this >>> https://pypi.python.org/pypi/datadiff >>> would be nice if we could extend datadiff with what pytest does for >>> string diff >>> and then just use datadiff for all assertions >>> because for now, it's not too useful to see a comparison of 2 dicts in >>> the pytest >>> it's not readable >>> especially if 2 dicts are big >>> and nowadays, json so dicts are everywhere >>> datadiff is cool at showing the diff between 2 dicts >>> the reason why im asking without the PR is the politics about the >>> dependencies >>> as i know you're not so positive about adding them >>> also this standalone mode is a bit tricky in that case, i guess >>> example: >>> >>> def test_ticket_filter_on_order_uid__in(app, first_ticket, >>> second_ticket, second_basket_ticket, order, second_order): >>> """Test if the right result is returned when filtering on basket.""" >>> ticket_filter = pta.ticket.filter(api_key=app.uid, >>> order_uid__in=[order['uid']]).content >>> > assert ticket_filter == [first_ticket, second_ticket] >>> E assert [{'code': '91...dulum'}, ...}] == [{'basket_uid'... 'EUR'}, >>> ...}] >>> E At index 0 diff: {'code': '911338060856', 'subtitle': {'en': >>> u'Subtitle1 Kaleidoscope'}, 'uid': u'37bc3c15e66a45e9bf3b52233fcdff02', >>> 'order_uid': u'08dec1bd7ec249109729de448ffcc571', 'price': {'currency': >>> 'EUR', 'amount': '1.20'}, 'fees': [{'price': {'currency': 'EUR', 'amount': >>> '2.00'}, 'type': 'service costs'}], 'product_uid': >>> u'32c2a6f98f0642b9843a8dcce6dead56', 'name': {'en': u'Ticket1 \u2603 >>> Weapon'}} != {'subtitle': {'en': u'Subtitle1 Kaleidoscope'}, 'uid': >>> u'37bc3c15e66a45e9bf3b52233fcdff02', 'price': {'currency': 'EUR', 'amount': >>> '1.20'}, 'fees': [{'price': {'currency': 'EUR', 'amount': '2.00'}, 'type': >>> 'service costs'}], 'basket_uid': u'871e829da04e4cd9a45d244f55824c83', >>> 'product_uid': u'32c2a6f98f0642b9843a8dcce6dead56', 'name': {'en': >>> u'Ticket1 \u2603 Weapon'}} >>> just unreadable >>> >>> >>> -- >>> Anatoly Bubenkov >>> >>> _______________________________________________ >>> 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 bubenkoff at gmail.com Tue Jul 29 22:17:54 2014 From: bubenkoff at gmail.com (Anatoly Bubenkov) Date: Tue, 29 Jul 2014 22:17:54 +0200 Subject: [pytest-dev] extended asserts In-Reply-To: References: Message-ID: Yes I'll do it as a separate plugin first Then we can think about including it in the core On Jul 29, 2014 9:46 PM, "Bruno Oliveira" wrote: > Hi, > > Perhaps this could a plugin (pytest-datadiff)? I know you can customize > assertion messages for other types (see > http://pytest.org/latest/assert.html#defining-your-own-assertion-comparison), > but I don't know how that plays with assertions already built in pytest. > > Cheers, > > > On Tue, Jul 29, 2014 at 5:24 AM, Anatoly Bubenkov > wrote: > >> what do you think about extending the existing assert representation with >> this >> https://pypi.python.org/pypi/datadiff >> would be nice if we could extend datadiff with what pytest does for >> string diff >> and then just use datadiff for all assertions >> because for now, it's not too useful to see a comparison of 2 dicts in >> the pytest >> it's not readable >> especially if 2 dicts are big >> and nowadays, json so dicts are everywhere >> datadiff is cool at showing the diff between 2 dicts >> the reason why im asking without the PR is the politics about the >> dependencies >> as i know you're not so positive about adding them >> also this standalone mode is a bit tricky in that case, i guess >> example: >> >> def test_ticket_filter_on_order_uid__in(app, first_ticket, second_ticket, >> second_basket_ticket, order, second_order): >> """Test if the right result is returned when filtering on basket.""" >> ticket_filter = pta.ticket.filter(api_key=app.uid, >> order_uid__in=[order['uid']]).content >> > assert ticket_filter == [first_ticket, second_ticket] >> E assert [{'code': '91...dulum'}, ...}] == [{'basket_uid'... 'EUR'}, ...}] >> E At index 0 diff: {'code': '911338060856', 'subtitle': {'en': >> u'Subtitle1 Kaleidoscope'}, 'uid': u'37bc3c15e66a45e9bf3b52233fcdff02', >> 'order_uid': u'08dec1bd7ec249109729de448ffcc571', 'price': {'currency': >> 'EUR', 'amount': '1.20'}, 'fees': [{'price': {'currency': 'EUR', 'amount': >> '2.00'}, 'type': 'service costs'}], 'product_uid': >> u'32c2a6f98f0642b9843a8dcce6dead56', 'name': {'en': u'Ticket1 \u2603 >> Weapon'}} != {'subtitle': {'en': u'Subtitle1 Kaleidoscope'}, 'uid': >> u'37bc3c15e66a45e9bf3b52233fcdff02', 'price': {'currency': 'EUR', 'amount': >> '1.20'}, 'fees': [{'price': {'currency': 'EUR', 'amount': '2.00'}, 'type': >> 'service costs'}], 'basket_uid': u'871e829da04e4cd9a45d244f55824c83', >> 'product_uid': u'32c2a6f98f0642b9843a8dcce6dead56', 'name': {'en': >> u'Ticket1 \u2603 Weapon'}} >> just unreadable >> >> >> -- >> Anatoly Bubenkov >> >> _______________________________________________ >> 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 bubenkoff at gmail.com Thu Jul 31 22:09:31 2014 From: bubenkoff at gmail.com (Anatoly Bubenkov) Date: Thu, 31 Jul 2014 22:09:31 +0200 Subject: [pytest-dev] pytest github organization is taken In-Reply-To: References: Message-ID: i've contacted github about this problem they say the account is NOT inactive, so all they can do is to pass a message from us to the owner so i've sent a polite message through them asking the owner to rename/grant access to us no reply yet, we'll see for now i've created pytest and pylib teams on bitbucket and pylib organization on github if github pytest organization will not be ours, then we can at least use pylib both on bb and github ps: still have to do PR about the organizing plugins On 28 July 2014 14:22, Anatoly Bubenkov wrote: > Hi all > if it was you who created this org https://github.com/pytest > please make Holger an admin > if this name was taken by someone who's not related to pytest in any way, > then we should make a claim to github to get the rights i guess > the org is empty and created Oct 21, 2013 > > -- > Anatoly Bubenkov > -- Anatoly Bubenkov -------------- next part -------------- An HTML attachment was scrubbed... URL: