{"action":"opened","issue":{"url":"https://api.github.com/repos/Frozenball/pytest-sugar/issues/73","labels_url":"https://api.github.com/repos/Frozenball/pytest-sugar/issues/73/labels{/name}","comments_url":"https://api.github.com/repos/Frozenball/pytest-sugar/issues/73/comments","events_url":"https://api.github.com/repos/Frozenball/pytest-sugar/issues/73/events","html_url":"https://github.com/Frozenball/pytest-sugar/issues/73","id":115349580,"number":73,"title":"Be friendlier w/_pytest.pytester","user":{"login":"wcooley","id":148118,"avatar_url":"https://avatars.githubusercontent.com/u/148118?v=3","gravatar_id":"","url":"https://api.github.com/users/wcooley","html_url":"https://github.com/wcooley","followers_url":"https://api.github.com/users/wcooley/followers","following_url":"https://api.github.com/users/wcooley/following{/other_user}","gists_url":"https://api.github.com/users/wcooley/gists{/gist_id}","starred_url":"https://api.github.com/users/wcooley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wcooley/subscriptions","organizations_url":"https://api.github.com/users/wcooley/orgs","repos_url":"https://api.github.com/users/wcooley/repos","events_url":"https://api.github.com/users/wcooley/events{/privacy}","received_events_url":"https://api.github.com/users/wcooley/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-05T18:57:42Z","updated_at":"2015-11-05T18:57:42Z","closed_at":null,"body":"When testing fixtures using `_pytest.pytester` with _pytest-sugar_ installed, it is necessary to explicitly disable with `-p no:sugar` in order to match output from a `testdir` fixture, like the example in the [pytest plugin for cookiecutter](https://github.com/pytest-dev/cookiecutter-pytest-plugin/blob/master/pytest-%7B%7Bcookiecutter.plugin_name%7D%7D/tests/test_%7B%7Bcookiecutter.plugin_name%7D%7D.py#L20):\r\n```\r\ndef test_bar_fixture(testdir):\r\n    \"\"\"Make sure that pytest accepts our fixture.\"\"\"\r\n\r\n    # create a temporary pytest test module\r\n    testdir.makepyfile(\"\"\"\r\n        def test_sth(bar):\r\n            assert bar == \"europython2015\"\r\n    \"\"\")\r\n\r\n    # run pytest with the following cmd args\r\n    result = testdir.runpytest(\r\n        '--foo=europython2015',\r\n        '-v'\r\n    )\r\n\r\n    # fnmatch_lines does an assertion internally\r\n    result.stdout.fnmatch_lines([\r\n        '*::test_sth PASSED',\r\n    ])\r\n```\r\n\r\nIn order for this to work w/_pytest-sugar_ installed, one must add `'-p no:sugar'`, which seems like an awfully specific piece to have to add; it also means that running tests for someone else's plugins that use _pytester_ will fail with _pytest-sugar_ installed (which can presumably be worked around by passing the argument in an environment variable).\r\n\r\nOne way to solve this problem is to check the configuration that `--color=` creates (after \"auto\" status has been determined) -- effectively making sugar sensitive to running in non-interactive/non-terminal environments in general, which is probably ideal. This might also help with the _pytest-xdist_ issues that I see here in the Github issue tracker, although I haven't looked at them closely enough to know if this is the case.\r\n\r\n"}}