{"action":"created","comment":{"url":"https://api.github.com/repos/ManageIQ/integration_tests/pulls/comments/82578594","pull_request_review_id":3467101,"id":82578594,"diff_hunk":"@@ -328,92 +259,53 @@ def pytest_generate_tests(metafunc):\n         for more details.\n \n     \"\"\"\n+    pf = ProviderFilter(types=types, required_fields=required_fields)\n+    return providers(metafunc, filters=[pf])\n \n-    argnames = []\n-    argvalues = []\n-    idlist = []\n-\n-    for provider in cfme_data.get('management_systems', {}):\n-\n-        # Check provider hasn't been filtered out with --use-provider\n-        if provider not in filtered:\n-            continue\n \n-        try:\n-            prov_obj = get_crud(provider)\n-        except UnknownProviderType:\n-            continue\n-\n-        if not prov_obj:\n-            logger.debug(\"Whilst trying to create an object for %s we failed\", provider)\n-            continue\n-\n-        if provider_types is not None:\n-            if not(prov_obj.type_tclass in provider_types or prov_obj.type_name in provider_types):\n-                continue\n-\n-        # Run through all the testgen uncollect fns\n-        uncollect = False\n-        uncollect_fns = [_uncollect_restricted_version, _check_required_fields,\n-            _uncollect_test_flags, _uncollect_since_version]\n-        for fn in uncollect_fns:\n-            if fn(prov_obj.data, metafunc, required_fields):\n-                uncollect = True\n-                break\n-        if uncollect:\n-            continue\n+def providers_by_category(metafunc, categories, required_fields=None):\n+    \"\"\"Get the values of the named field keys from ``cfme_data.get('management_systems', {})``\n+    Args:\n+        categories: A list of provider categories to include. If None, all providers are considered\n \n-        if 'provider' in metafunc.fixturenames and 'provider' not in argnames:\n-            metafunc.function = pytest.mark.uses_testgen()(metafunc.function)\n-            argnames.append('provider')\n+    Usage:\n \n-        # uncollect when required field is not present and option['require_field'] == True\n-        argvalues.append([prov_obj])\n+        # In the function itself\n+        def pytest_generate_tests(metafunc):\n+            argnames, argvalues, idlist = testgen.providers_by_category(\n+                ['cloud', 'containers'], required_fields=['provisioning']\n+            )\n+        metafunc.parametrize(argnames, argvalues, ids=idlist, scope='module')\n \n-        # Use the provider name for idlist, helps with readable parametrized test output\n-        idlist.append(provider)\n+        # Using the parametrize wrapper\n+        pytest_generate_tests = testgen.parametrize(testgen.providers_by_category, ['cloud'],\n+            scope='module')\n \n-    return argnames, argvalues, idlist\n+    Note:\n+        See :py:func:`providers_by_type` for more information.\n+    \"\"\"\n+    pf = ProviderFilter(categories=categories, required_fields=required_fields)\n+    return providers(metafunc, filters=[pf])\n \n \n def cloud_providers(metafunc, **options):","path":"utils/testgen.py","position":262,"original_position":262,"commit_id":"b511ba51777517c66108a416a2c492914781f52e","original_commit_id":"b511ba51777517c66108a416a2c492914781f52e","user":{"login":"psav","id":5639745,"avatar_url":"https://avatars.githubusercontent.com/u/5639745?v=3","gravatar_id":"","url":"https://api.github.com/users/psav","html_url":"https://github.com/psav","followers_url":"https://api.github.com/users/psav/followers","following_url":"https://api.github.com/users/psav/following{/other_user}","gists_url":"https://api.github.com/users/psav/gists{/gist_id}","starred_url":"https://api.github.com/users/psav/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/psav/subscriptions","organizations_url":"https://api.github.com/users/psav/orgs","repos_url":"https://api.github.com/users/psav/repos","events_url":"https://api.github.com/users/psav/events{/privacy}","received_events_url":"https://api.github.com/users/psav/received_events","type":"User","site_admin":false},"body":"I want to get rid of these. We shouldn't use them they are far too specific to provider categories. Thoughts?","created_at":"2016-10-10T10:32:06Z","updated_at":"2016-10-10T10:32:17Z","html_url":"https://github.com/ManageIQ/integration_tests/pull/3585#discussion_r82578594","pull_request_url":"https://api.github.com/repos/ManageIQ/integration_tests/pulls/3585","_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/integration_tests/pulls/comments/82578594"},"html":{"href":"https://github.com/ManageIQ/integration_tests/pull/3585#discussion_r82578594"},"pull_request":{"href":"https://api.github.com/repos/ManageIQ/integration_tests/pulls/3585"}}},"pull_request":{"url":"https://api.github.com/repos/ManageIQ/integration_tests/pulls/3585","id":88248933,"html_url":"https://github.com/ManageIQ/integration_tests/pull/3585","diff_url":"https://github.com/ManageIQ/integration_tests/pull/3585.diff","patch_url":"https://github.com/ManageIQ/integration_tests/pull/3585.patch","issue_url":"https://api.github.com/repos/ManageIQ/integration_tests/issues/3585","number":3585,"state":"open","locked":false,"title":"[WIP][NOTEST] Refactor utils.providers and testgen","user":{"login":"jkrocil","id":964523,"avatar_url":"https://avatars.githubusercontent.com/u/964523?v=3","gravatar_id":"","url":"https://api.github.com/users/jkrocil","html_url":"https://github.com/jkrocil","followers_url":"https://api.github.com/users/jkrocil/followers","following_url":"https://api.github.com/users/jkrocil/following{/other_user}","gists_url":"https://api.github.com/users/jkrocil/gists{/gist_id}","starred_url":"https://api.github.com/users/jkrocil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkrocil/subscriptions","organizations_url":"https://api.github.com/users/jkrocil/orgs","repos_url":"https://api.github.com/users/jkrocil/repos","events_url":"https://api.github.com/users/jkrocil/events{/privacy}","received_events_url":"https://api.github.com/users/jkrocil/received_events","type":"User","site_admin":false},"body":"## Refactor `utils.providers` and `utils.testgen`:\r\nAdd `utils.providers.ProviderFilter`\r\nIntroduce `utils.providers.global_filters`\r\nFix `Appliance.managed_providers` to return all provider types\r\n`Provider.type_tclass` => `Provider.category`\r\n`utils.providers.setup_provider` now goes directly through `Provider.create`\r\nProvider objects now can be compared\r\n`utils.providers.existing_providers` now simply lists providers' whose `exists` returned `True`\r\nPassing provider objects around instead of provider keys\r\n`testgen.provider_by_type` => `testgen.providers_by_type`\r\nAdd `testgen.providers_by_category`\r\nAdd `testgen.providers` which is used by the two fns above\r\n`destroy_vm` moved out of `utils.providers` to the only place where it was being used\r\nRemove `utils.providers.setup_provider_by_name`\r\nRemove `utils.providers.setup_providers`\r\nRemove `utils.providers._setup_providers`\r\nRemove `utils.providers.is_provider_setup`\r\nRemove `utils.providers.get_mgmt_by_name`\r\nAdd `utils.providers.get_crud_by_name`\r\nRefactor `utils.appliance.*evm_service*` stuff to use systemctl and go through generic `_evm_service_command`\r\nFix db_migrate test","created_at":"2016-10-06T12:06:11Z","updated_at":"2016-10-10T10:32:17Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bb6405c573008ebea4c6002b2d748aafe4c0e573","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ManageIQ/integration_tests/pulls/3585/commits","review_comments_url":"https://api.github.com/repos/ManageIQ/integration_tests/pulls/3585/comments","review_comment_url":"https://api.github.com/repos/ManageIQ/integration_tests/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ManageIQ/integration_tests/issues/3585/comments","statuses_url":"https://api.github.com/repos/ManageIQ/integration_tests/statuses/b511ba51777517c66108a416a2c492914781f52e","head":{"label":"jkrocil:refactor-all-the-things","ref":"refactor-all-the-things","sha":"b511ba51777517c66108a416a2c492914781f52e","user":{"login":"jkrocil","id":964523,"avatar_url":"https://avatars.githubusercontent.com/u/964523?v=3","gravatar_id":"","url":"https://api.github.com/users/jkrocil","html_url":"https://github.com/jkrocil","followers_url":"https://api.github.com/users/jkrocil/followers","following_url":"https://api.github.com/users/jkrocil/following{/other_user}","gists_url":"https://api.github.com/users/jkrocil/gists{/gist_id}","starred_url":"https://api.github.com/users/jkrocil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkrocil/subscriptions","organizations_url":"https://api.github.com/users/jkrocil/orgs","repos_url":"https://api.github.com/users/jkrocil/repos","events_url":"https://api.github.com/users/jkrocil/events{/privacy}","received_events_url":"https://api.github.com/users/jkrocil/received_events","type":"User","site_admin":false},"repo":{"id":12429257,"name":"integration_tests","full_name":"jkrocil/integration_tests","owner":{"login":"jkrocil","id":964523,"avatar_url":"https://avatars.githubusercontent.com/u/964523?v=3","gravatar_id":"","url":"https://api.github.com/users/jkrocil","html_url":"https://github.com/jkrocil","followers_url":"https://api.github.com/users/jkrocil/followers","following_url":"https://api.github.com/users/jkrocil/following{/other_user}","gists_url":"https://api.github.com/users/jkrocil/gists{/gist_id}","starred_url":"https://api.github.com/users/jkrocil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkrocil/subscriptions","organizations_url":"https://api.github.com/users/jkrocil/orgs","repos_url":"https://api.github.com/users/jkrocil/repos","events_url":"https://api.github.com/users/jkrocil/events{/privacy}","received_events_url":"https://api.github.com/users/jkrocil/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jkrocil/integration_tests","description":"CloudForms Management Engine - Functional tests","fork":true,"url":"https://api.github.com/repos/jkrocil/integration_tests","forks_url":"https://api.github.com/repos/jkrocil/integration_tests/forks","keys_url":"https://api.github.com/repos/jkrocil/integration_tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jkrocil/integration_tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jkrocil/integration_tests/teams","hooks_url":"https://api.github.com/repos/jkrocil/integration_tests/hooks","issue_events_url":"https://api.github.com/repos/jkrocil/integration_tests/issues/events{/number}","events_url":"https://api.github.com/repos/jkrocil/integration_tests/events","assignees_url":"https://api.github.com/repos/jkrocil/integration_tests/assignees{/user}","branches_url":"https://api.github.com/repos/jkrocil/integration_tests/branches{/branch}","tags_url":"https://api.github.com/repos/jkrocil/integration_tests/tags","blobs_url":"https://api.github.com/repos/jkrocil/integration_tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jkrocil/integration_tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jkrocil/integration_tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/jkrocil/integration_tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jkrocil/integration_tests/statuses/{sha}","languages_url":"https://api.github.com/repos/jkrocil/integration_tests/languages","stargazers_url":"https://api.github.com/repos/jkrocil/integration_tests/stargazers","contributors_url":"https://api.github.com/repos/jkrocil/integration_tests/contributors","subscribers_url":"https://api.github.com/repos/jkrocil/integration_tests/subscribers","subscription_url":"https://api.github.com/repos/jkrocil/integration_tests/subscription","commits_url":"https://api.github.com/repos/jkrocil/integration_tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/jkrocil/integration_tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/jkrocil/integration_tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/jkrocil/integration_tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/jkrocil/integration_tests/contents/{+path}","compare_url":"https://api.github.com/repos/jkrocil/integration_tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jkrocil/integration_tests/merges","archive_url":"https://api.github.com/repos/jkrocil/integration_tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jkrocil/integration_tests/downloads","issues_url":"https://api.github.com/repos/jkrocil/integration_tests/issues{/number}","pulls_url":"https://api.github.com/repos/jkrocil/integration_tests/pulls{/number}","milestones_url":"https://api.github.com/repos/jkrocil/integration_tests/milestones{/number}","notifications_url":"https://api.github.com/repos/jkrocil/integration_tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jkrocil/integration_tests/labels{/name}","releases_url":"https://api.github.com/repos/jkrocil/integration_tests/releases{/id}","deployments_url":"https://api.github.com/repos/jkrocil/integration_tests/deployments","created_at":"2013-08-28T09:02:39Z","updated_at":"2016-10-07T09:48:54Z","pushed_at":"2016-10-07T09:46:04Z","git_url":"git://github.com/jkrocil/integration_tests.git","ssh_url":"git@github.com:jkrocil/integration_tests.git","clone_url":"https://github.com/jkrocil/integration_tests.git","svn_url":"https://github.com/jkrocil/integration_tests","homepage":"","size":11792,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ManageIQ:master","ref":"master","sha":"819c031c5415afd721922a2d6abca88c5f7bd06e","user":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"repo":{"id":8061086,"name":"integration_tests","full_name":"ManageIQ/integration_tests","owner":{"login":"ManageIQ","id":1125575,"avatar_url":"https://avatars.githubusercontent.com/u/1125575?v=3","gravatar_id":"","url":"https://api.github.com/users/ManageIQ","html_url":"https://github.com/ManageIQ","followers_url":"https://api.github.com/users/ManageIQ/followers","following_url":"https://api.github.com/users/ManageIQ/following{/other_user}","gists_url":"https://api.github.com/users/ManageIQ/gists{/gist_id}","starred_url":"https://api.github.com/users/ManageIQ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ManageIQ/subscriptions","organizations_url":"https://api.github.com/users/ManageIQ/orgs","repos_url":"https://api.github.com/users/ManageIQ/repos","events_url":"https://api.github.com/users/ManageIQ/events{/privacy}","received_events_url":"https://api.github.com/users/ManageIQ/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ManageIQ/integration_tests","description":"ManageIQ integration tests","fork":false,"url":"https://api.github.com/repos/ManageIQ/integration_tests","forks_url":"https://api.github.com/repos/ManageIQ/integration_tests/forks","keys_url":"https://api.github.com/repos/ManageIQ/integration_tests/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ManageIQ/integration_tests/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ManageIQ/integration_tests/teams","hooks_url":"https://api.github.com/repos/ManageIQ/integration_tests/hooks","issue_events_url":"https://api.github.com/repos/ManageIQ/integration_tests/issues/events{/number}","events_url":"https://api.github.com/repos/ManageIQ/integration_tests/events","assignees_url":"https://api.github.com/repos/ManageIQ/integration_tests/assignees{/user}","branches_url":"https://api.github.com/repos/ManageIQ/integration_tests/branches{/branch}","tags_url":"https://api.github.com/repos/ManageIQ/integration_tests/tags","blobs_url":"https://api.github.com/repos/ManageIQ/integration_tests/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ManageIQ/integration_tests/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ManageIQ/integration_tests/git/refs{/sha}","trees_url":"https://api.github.com/repos/ManageIQ/integration_tests/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ManageIQ/integration_tests/statuses/{sha}","languages_url":"https://api.github.com/repos/ManageIQ/integration_tests/languages","stargazers_url":"https://api.github.com/repos/ManageIQ/integration_tests/stargazers","contributors_url":"https://api.github.com/repos/ManageIQ/integration_tests/contributors","subscribers_url":"https://api.github.com/repos/ManageIQ/integration_tests/subscribers","subscription_url":"https://api.github.com/repos/ManageIQ/integration_tests/subscription","commits_url":"https://api.github.com/repos/ManageIQ/integration_tests/commits{/sha}","git_commits_url":"https://api.github.com/repos/ManageIQ/integration_tests/git/commits{/sha}","comments_url":"https://api.github.com/repos/ManageIQ/integration_tests/comments{/number}","issue_comment_url":"https://api.github.com/repos/ManageIQ/integration_tests/issues/comments{/number}","contents_url":"https://api.github.com/repos/ManageIQ/integration_tests/contents/{+path}","compare_url":"https://api.github.com/repos/ManageIQ/integration_tests/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ManageIQ/integration_tests/merges","archive_url":"https://api.github.com/repos/ManageIQ/integration_tests/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ManageIQ/integration_tests/downloads","issues_url":"https://api.github.com/repos/ManageIQ/integration_tests/issues{/number}","pulls_url":"https://api.github.com/repos/ManageIQ/integration_tests/pulls{/number}","milestones_url":"https://api.github.com/repos/ManageIQ/integration_tests/milestones{/number}","notifications_url":"https://api.github.com/repos/ManageIQ/integration_tests/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ManageIQ/integration_tests/labels{/name}","releases_url":"https://api.github.com/repos/ManageIQ/integration_tests/releases{/id}","deployments_url":"https://api.github.com/repos/ManageIQ/integration_tests/deployments","created_at":"2013-02-06T21:59:17Z","updated_at":"2016-09-08T11:55:58Z","pushed_at":"2016-10-09T12:54:12Z","git_url":"git://github.com/ManageIQ/integration_tests.git","ssh_url":"git@github.com:ManageIQ/integration_tests.git","clone_url":"https://github.com/ManageIQ/integration_tests.git","svn_url":"https://github.com/ManageIQ/integration_tests","homepage":"","size":17138,"stargazers_count":30,"watchers_count":30,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":67,"mirror_url":null,"open_issues_count":93,"forks":67,"open_issues":93,"watchers":30,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ManageIQ/integration_tests/pulls/3585"},"html":{"href":"https://github.com/ManageIQ/integration_tests/pull/3585"},"issue":{"href":"https://api.github.com/repos/ManageIQ/integration_tests/issues/3585"},"comments":{"href":"https://api.github.com/repos/ManageIQ/integration_tests/issues/3585/comments"},"review_comments":{"href":"https://api.github.com/repos/ManageIQ/integration_tests/pulls/3585/comments"},"review_comment":{"href":"https://api.github.com/repos/ManageIQ/integration_tests/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ManageIQ/integration_tests/pulls/3585/commits"},"statuses":{"href":"https://api.github.com/repos/ManageIQ/integration_tests/statuses/b511ba51777517c66108a416a2c492914781f52e"}}}}
{"actor":{"display_login":"psav"}}