)]}'
{"hacking/tests/test_doctest.py":[{"author":{"_account_id":28522,"name":"Hervé Beraud","email":"herveberaud.pro@gmail.com","username":"hberaud"},"change_message_id":"d9267f54e8a0ffcccd6235f7b1ee4db843e3561f","unresolved":false,"context_lines":[{"line_number":68,"context_line":"        app \u003d application.Application()"},{"line_number":69,"context_line":""},{"line_number":70,"context_line":"        with tempfile.NamedTemporaryFile(delete\u003dFalse) as f:"},{"line_number":71,"context_line":"            f.write(\u0027\u0027.join(self.lines))"},{"line_number":72,"context_line":"            # app.run([\u0027flake8\u0027, \u0027--isolated\u0027, \u0027--select\u0027, self.code,"},{"line_number":73,"context_line":"            #          \u0027--ignore\u0027, \u0027F\u0027, f.name])"},{"line_number":74,"context_line":"            cmd \u003d [sys.executable, \u0027-mflake8\u0027, \u0027--isolated\u0027,"}],"source_content_type":"text/x-python","patch_set":1,"id":"3fa7e38b_622368bf","line":71,"range":{"start_line":71,"start_character":12,"end_line":71,"end_character":40},"updated":"2019-12-11 14:46:22.000000000","message":"Hum weird... \n\n```\nb\u0027Traceback (most recent call last):\u0027\n2019-12-11 13:19:03.912317 | ubuntu-bionic |     b\u0027  File \"/home/zuul/src/opendev.org/openstack/hacking/hacking/tests/test_doctest.py\", line 71, in test_flake8\u0027\n2019-12-11 13:19:03.912381 | ubuntu-bionic |     b\"    f.write(\u0027\u0027.join(self.lines))\"\n2019-12-11 13:19:03.912538 | ubuntu-bionic |     b\u0027  File \"/home/zuul/src/opendev.org/openstack/hacking/.tox/py37/lib/python3.7/tempfile.py\", line 620, in func_wrapper\u0027\n2019-12-11 13:19:03.912634 | ubuntu-bionic |     b\u0027    return func(*args, **kwargs)\u0027\n2019-12-11 13:19:03.912717 | ubuntu-bionic |     b\"TypeError: a bytes-like object is required, not \u0027str\u0027\"\n2019-12-11 13:19:03.912741 | ubuntu-bionic |     b\u0027\u0027\n```\n\nI think this happen because we need to give a mode to open.\n\nBy default tempfile.NamedTemporaryFile will open a file in binary mode if nothing is specified \u003d\u003e \n\nhttps://docs.python.org/3/library/tempfile.html#tempfile.NamedTemporaryFile \n\nSo I thing we need to replace with:\n\n```\nwith tempfile.NamedTemporaryFile(mode\u003d\u0027w+\u0027, delete\u003dFalse) as f:\n```\n\nor encode data properly before writing something to the file.\n\nhttps://storage.gra.cloud.ovh.net/v1/AUTH_dcaab5e32b234d56b626f72581e3644c/zuul_opendev_logs_55b/698473/1/check/openstack-tox-py37/55b6b97/job-output.txt","commit_id":"5913298ae06bab7655046ce4ce27bc5553fc86ac"}]}
