{"action":"opened","issue":{"url":"https://api.github.com/repos/kubeflow/tf-operator/issues/851","repository_url":"https://api.github.com/repos/kubeflow/tf-operator","labels_url":"https://api.github.com/repos/kubeflow/tf-operator/issues/851/labels{/name}","comments_url":"https://api.github.com/repos/kubeflow/tf-operator/issues/851/comments","events_url":"https://api.github.com/repos/kubeflow/tf-operator/issues/851/events","html_url":"https://github.com/kubeflow/tf-operator/issues/851","id":373703112,"node_id":"MDU6SXNzdWUzNzM3MDMxMTI=","number":851,"title":"Enhance the test harness so that our tests can be run as Python unit tests","user":{"login":"richardsliu","id":39319471,"node_id":"MDQ6VXNlcjM5MzE5NDcx","avatar_url":"https://avatars1.githubusercontent.com/u/39319471?v=4","gravatar_id":"","url":"https://api.github.com/users/richardsliu","html_url":"https://github.com/richardsliu","followers_url":"https://api.github.com/users/richardsliu/followers","following_url":"https://api.github.com/users/richardsliu/following{/other_user}","gists_url":"https://api.github.com/users/richardsliu/gists{/gist_id}","starred_url":"https://api.github.com/users/richardsliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardsliu/subscriptions","organizations_url":"https://api.github.com/users/richardsliu/orgs","repos_url":"https://api.github.com/users/richardsliu/repos","events_url":"https://api.github.com/users/richardsliu/events{/privacy}","received_events_url":"https://api.github.com/users/richardsliu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-24T22:31:41Z","updated_at":"2018-10-24T22:31:41Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Quoted from https://github.com/kubeflow/tf-operator/pull/849:\r\n\r\nDo we need our own \"main()\"? Could we just use unittest.main()? Or if need be subclass unittest.main()?\r\n\r\nI think one of the advantages of reusing unittest.main() is that out of the box it supports a lot of useful parameters. e.g. we can run a single test\r\n\r\npython my_module.py TestClass.test_func\r\n\r\nShould Test Case subclass unittest.TestCase? This would allow us to use the stand assert macros to do test validation.\r\n\r\nInstead of creating our own TestCase should we just be creating our own TestRunner suitable for reporting results to Prow (https://docs.python.org/3/library/unittest.html)?\r\n\r\nThen we could just change the TestRunner when running under Prow but in all other ways our tests would just be Py Unittests and it would be much easier to run them locally or without Prow.\r\n\r\nI think if we had our own TestRunner we could do something like this\r\n\r\nif name == \"main\":\r\ntest_runner = None\r\nif os.getenv(\"IS_PROW):\r\ntest_runner = test_util.TestRunner()\r\nunittest.main(testRunner=test_runner)\r\n\r\nhttps://github.com/python/cpython/blob/master/Lib/unittest/main.py#L55"}}
{"actor":{"display_login":"richardsliu"}}