{"action":"created","issue":{"url":"https://api.github.com/repos/pytest-dev/pytest-xdist/issues/84","repository_url":"https://api.github.com/repos/pytest-dev/pytest-xdist","labels_url":"https://api.github.com/repos/pytest-dev/pytest-xdist/issues/84/labels{/name}","comments_url":"https://api.github.com/repos/pytest-dev/pytest-xdist/issues/84/comments","events_url":"https://api.github.com/repos/pytest-dev/pytest-xdist/issues/84/events","html_url":"https://github.com/pytest-dev/pytest-xdist/issues/84","id":171794077,"number":84,"title":"Enforce serial execution of related tests","user":{"login":"betamos","id":135960,"avatar_url":"https://avatars.githubusercontent.com/u/135960?v=3","gravatar_id":"","url":"https://api.github.com/users/betamos","html_url":"https://github.com/betamos","followers_url":"https://api.github.com/users/betamos/followers","following_url":"https://api.github.com/users/betamos/following{/other_user}","gists_url":"https://api.github.com/users/betamos/gists{/gist_id}","starred_url":"https://api.github.com/users/betamos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/betamos/subscriptions","organizations_url":"https://api.github.com/users/betamos/orgs","repos_url":"https://api.github.com/users/betamos/repos","events_url":"https://api.github.com/users/betamos/events{/privacy}","received_events_url":"https://api.github.com/users/betamos/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-08-18T00:53:53Z","updated_at":"2016-08-18T02:38:18Z","closed_at":"2016-08-18T02:38:18Z","body":"I think this is related to https://github.com/pytest-dev/pytest-xdist/issues/18 but didn't want to clutter the comment history if that's not the case.\r\n\r\nI am looking for a way to enforce certain tests, usually the tests within a specific class, to be executed in serial due to that they interfere with each other. I could use `-n0` but that would be an overreach - it would apply to the entire test run, not just for a specific class for instance. Would it be possible to just have a decorator directive on the class to 1. instruct xdist to schedule the tests in the class to the same slave as well as 2. instruct them to be run in serial?\r\n\r\nIf there are other ways of achieving this, I would be interested in that too.\r\n\r\nThanks for a great product."},"comment":{"url":"https://api.github.com/repos/pytest-dev/pytest-xdist/issues/comments/240608210","html_url":"https://github.com/pytest-dev/pytest-xdist/issues/84#issuecomment-240608210","issue_url":"https://api.github.com/repos/pytest-dev/pytest-xdist/issues/84","id":240608210,"user":{"login":"nicoddemus","id":1085180,"avatar_url":"https://avatars.githubusercontent.com/u/1085180?v=3","gravatar_id":"","url":"https://api.github.com/users/nicoddemus","html_url":"https://github.com/nicoddemus","followers_url":"https://api.github.com/users/nicoddemus/followers","following_url":"https://api.github.com/users/nicoddemus/following{/other_user}","gists_url":"https://api.github.com/users/nicoddemus/gists{/gist_id}","starred_url":"https://api.github.com/users/nicoddemus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicoddemus/subscriptions","organizations_url":"https://api.github.com/users/nicoddemus/orgs","repos_url":"https://api.github.com/users/nicoddemus/repos","events_url":"https://api.github.com/users/nicoddemus/events{/privacy}","received_events_url":"https://api.github.com/users/nicoddemus/received_events","type":"User","site_admin":false},"created_at":"2016-08-18T02:38:18Z","updated_at":"2016-08-18T02:38:18Z","body":"Hey @betamos,\r\n\r\nThis is what #18 is about... unfortunately nobody got the time to work on it yet.\r\n\r\nHere's a solution that works at my workplace:\r\n\r\n1. Mark the tests you want to execute serially with a special mark, say `serial`:\r\n\r\n    ```python\r\n    @pytest.mark.serial\r\n    class Test:        \r\n        ...\r\n\r\n    @pytest.mark.serial    \r\n    def test_foo():\r\n        ...\r\n    ```\r\n\r\n\r\n2. Execute your parallel tests, excluding those with the `serial` mark:\r\n\r\n  ```\r\n  $ py.test -n auto -m \"not serial\"\r\n  ```\r\n\r\n3. Next, execute your serial tests in a separate session:\r\n\r\n  ```\r\n  $ py.test -n0 -m \"serial\"\r\n  ```\r\n\r\nThis works perfectly fine in C.I. servers, since it is usually trivial to add an additional command-line to the job.\r\n\r\nI will close this now since it is a duplicate of #18, but let me know if you have any other questions."}}
{"actor":{"display_login":"nicoddemus"}}