{"action":"created","issue":{"url":"https://api.github.com/repos/mitsuhiko/flask/issues/1591","labels_url":"https://api.github.com/repos/mitsuhiko/flask/issues/1591/labels{/name}","comments_url":"https://api.github.com/repos/mitsuhiko/flask/issues/1591/comments","events_url":"https://api.github.com/repos/mitsuhiko/flask/issues/1591/events","html_url":"https://github.com/mitsuhiko/flask/issues/1591","id":112725695,"number":1591,"title":"Example code leaked when running test","user":{"login":"shulhi","id":913103,"avatar_url":"https://avatars.githubusercontent.com/u/913103?v=3","gravatar_id":"","url":"https://api.github.com/users/shulhi","html_url":"https://github.com/shulhi","followers_url":"https://api.github.com/users/shulhi/followers","following_url":"https://api.github.com/users/shulhi/following{/other_user}","gists_url":"https://api.github.com/users/shulhi/gists{/gist_id}","starred_url":"https://api.github.com/users/shulhi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shulhi/subscriptions","organizations_url":"https://api.github.com/users/shulhi/orgs","repos_url":"https://api.github.com/users/shulhi/repos","events_url":"https://api.github.com/users/shulhi/events{/privacy}","received_events_url":"https://api.github.com/users/shulhi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"mitsuhiko","id":7396,"avatar_url":"https://avatars.githubusercontent.com/u/7396?v=3","gravatar_id":"","url":"https://api.github.com/users/mitsuhiko","html_url":"https://github.com/mitsuhiko","followers_url":"https://api.github.com/users/mitsuhiko/followers","following_url":"https://api.github.com/users/mitsuhiko/following{/other_user}","gists_url":"https://api.github.com/users/mitsuhiko/gists{/gist_id}","starred_url":"https://api.github.com/users/mitsuhiko/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mitsuhiko/subscriptions","organizations_url":"https://api.github.com/users/mitsuhiko/orgs","repos_url":"https://api.github.com/users/mitsuhiko/repos","events_url":"https://api.github.com/users/mitsuhiko/events{/privacy}","received_events_url":"https://api.github.com/users/mitsuhiko/received_events","type":"User","site_admin":false},"milestone":null,"comments":6,"created_at":"2015-10-22T03:45:14Z","updated_at":"2015-11-26T22:04:52Z","closed_at":null,"body":"Running `py.test` leads to \r\n\r\n```\r\ntests/test_regression.py:72:\r\n_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _\r\n\r\nself = <test_regression.assert_no_leak object at 0x104105550>, exc_type = None, exc_value = None, tb = None\r\n\r\n    def __exit__(self, exc_type, exc_value, tb):\r\n        if not hasattr(sys, 'getrefcount'):\r\n            gc.collect()\r\n        new_objects = len(gc.get_objects())\r\n        if new_objects > self.old_objects:\r\n>           pytest.fail('Example code leaked')\r\nE           Failed: Example code leaked\r\n```\r\n\r\nI think this is an old issue (#452). I run the test on both CPython 2.7.8 and 3.5.0, and it failed on both occasions."},"comment":{"url":"https://api.github.com/repos/mitsuhiko/flask/issues/comments/159998434","html_url":"https://github.com/mitsuhiko/flask/issues/1591#issuecomment-159998434","issue_url":"https://api.github.com/repos/mitsuhiko/flask/issues/1591","id":159998434,"user":{"login":"redian","id":816941,"avatar_url":"https://avatars.githubusercontent.com/u/816941?v=3","gravatar_id":"","url":"https://api.github.com/users/redian","html_url":"https://github.com/redian","followers_url":"https://api.github.com/users/redian/followers","following_url":"https://api.github.com/users/redian/following{/other_user}","gists_url":"https://api.github.com/users/redian/gists{/gist_id}","starred_url":"https://api.github.com/users/redian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redian/subscriptions","organizations_url":"https://api.github.com/users/redian/orgs","repos_url":"https://api.github.com/users/redian/repos","events_url":"https://api.github.com/users/redian/events{/privacy}","received_events_url":"https://api.github.com/users/redian/received_events","type":"User","site_admin":false},"created_at":"2015-11-26T22:04:52Z","updated_at":"2015-11-26T22:04:52Z","body":"This test fails for me too: \r\n```\r\nself = <test_regression.assert_no_leak object at 0x1041a3630>, exc_type = None, exc_value = None, tb = None\r\n\r\n    def __exit__(self, exc_type, exc_value, tb):\r\n        if not hasattr(sys, 'getrefcount'):\r\n            gc.collect()\r\n        new_objects = len(gc.get_objects())\r\n        if new_objects > self.old_objects:\r\n>           pytest.fail('Example code leaked')\r\nE           Failed: Example code leaked\r\n\r\ntests/test_regression.py:46: Failed\r\n```\r\n\r\nHere are my virtual environment packages installed:\r\n\r\n```\r\nconda list\r\n# packages in environment at /Users/redian/miniconda3/envs/flask:\r\n#\r\nappdirs                   1.4.0                     <pip>\r\nbaron                     0.6.1                     <pip>\r\nclick                     6.0                       <pip>\r\nflask                     0.10.1                    <pip>\r\nitsdangerous              0.24                      <pip>\r\njinja2                    2.8                       <pip>\r\nmarkupsafe                0.23                      <pip>\r\nopenssl                   1.0.2d                        0  \r\npip                       7.1.2                    py34_0  \r\npy                        1.4.30                    <pip>\r\npygments                  2.0.2                     <pip>\r\npytest                    2.8.3                     <pip>\r\npython                    3.4.3                         2  \r\nreadline                  6.2                           2  \r\nrply                      0.7.4                     <pip>\r\nsetuptools                18.5                     py34_0  \r\nsqlite                    3.8.4.1                       1  \r\ntk                        8.5.18                        0  \r\nwerkzeug                  0.11.2                    <pip>\r\nwheel                     0.26.0                   py34_1  \r\nxz                        5.0.5                         0  \r\nzlib                      1.2.8                         0  \r\n```\r\n\r\nCan we do something about this.\r\n\r\nI read the comment on like 67 mentioning that this test works only on python 2.7 \r\n```\r\n    # This test only works on CPython 2.7.\r\n    if sys.version_info >= (2, 7) and \\\r\n            not hasattr(sys, 'pypy_translation_info'):\r\n        with assert_no_leak():\r\n            for x in range(10):\r\n                fire()\r\n```\r\ncan we change the `>=` operator to `==` instead ?"}}