diff options
| author | Vu Tran <vu.tran@windriver.com> | 2014-07-10 10:23:50 -0400 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2014-07-17 00:12:13 -0400 |
| commit | ac22bcdf86fa6d687ed9421c0de39cb131e0c62d (patch) | |
| tree | aba49699f755d6ac9f55d8613de7cd3f368190ba /meta-openstack/recipes-devtools/python/python-rally | |
| parent | f550a375c091a27aeb80d64140c943beba788127 (diff) | |
| download | meta-cloud-services-ac22bcdf86fa6d687ed9421c0de39cb131e0c62d.tar.gz | |
rally: verification subunit2json fail to open result file
Command "rally verify start" gives the following error:
TRACE rally File "/usr/lib64/python2.7/site-packages/rally/verification/verifiers/tempest/subunit2json.py", line 113, in stopTestRun
TRACE rally with open(self.results_file, 'wb') as results_file:
TRACE rally TypeError: coercing to Unicode: need string or buffer, int found
For Python 2.x, open() requires a string but not file descriptor number.
However for Python 3.x, open() can either accept a string file name of a
file descriptor number.
So modify code to pass in open() string file name. This should work
for both Python 2.x and 3.x
Signed-off-by: Vu Tran <vu.tran@windriver.com>
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-rally')
| -rw-r--r-- | meta-openstack/recipes-devtools/python/python-rally/verification-subunit2json-fail-to-open-result-file.patch | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-rally/verification-subunit2json-fail-to-open-result-file.patch b/meta-openstack/recipes-devtools/python/python-rally/verification-subunit2json-fail-to-open-result-file.patch new file mode 100644 index 0000000..7257740 --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-rally/verification-subunit2json-fail-to-open-result-file.patch | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | verification: subunit2json fail to open result file | ||
| 2 | |||
| 3 | Command "rally verify start" gives the following error: | ||
| 4 | |||
| 5 | TRACE rally File "/usr/lib64/python2.7/site-packages/rally/verification/verifiers/tempest/subunit2json.py", line 113, in stopTestRun | ||
| 6 | TRACE rally with open(self.results_file, 'wb') as results_file: | ||
| 7 | TRACE rally TypeError: coercing to Unicode: need string or buffer, int found | ||
| 8 | |||
| 9 | Python open() requires a string but not file discriptor number. | ||
| 10 | |||
| 11 | Signed-off-by: Vu Tran <vu.tran@windriver.com> | ||
| 12 | |||
| 13 | diff --git a/rally/verification/verifiers/tempest/subunit2json.py b/rally/verification/verifiers/tempest/subunit2json.py | ||
| 14 | index 719f814..f74b13c 100644 | ||
| 15 | --- a/rally/verification/verifiers/tempest/subunit2json.py | ||
| 16 | +++ b/rally/verification/verifiers/tempest/subunit2json.py | ||
| 17 | @@ -137,7 +137,7 @@ class FileAccumulator(testtools.StreamResult): | ||
| 18 | |||
| 19 | |||
| 20 | def main(subunit_log_file): | ||
| 21 | - results_file, _ = tempfile.mkstemp() | ||
| 22 | + _, results_file = tempfile.mkstemp() | ||
| 23 | result = JsonOutput(results_file) | ||
| 24 | stream = open(subunit_log_file, 'rb') | ||
| 25 | |||
| 26 | @@ -161,8 +161,8 @@ def main(subunit_log_file): | ||
| 27 | suite = subunit.ProtocolTestCase(bytes_io) | ||
| 28 | suite.run(result) | ||
| 29 | result.stopTestRun() | ||
| 30 | - with open(results_file, 'rb') as results_file: | ||
| 31 | - data = results_file.read() | ||
| 32 | + with open(results_file, 'rb') as results_file_fd: | ||
| 33 | + data = results_file_fd.read() | ||
| 34 | try: | ||
| 35 | os.unlink(results_file) | ||
| 36 | except OSError as e: | ||
