1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-07-27 18:02:17 +03:00

Fix Python3 errors for device tests (#6670)

* Fix Python3 errors for device tests

The Python3 migration didn't include fixes for local scripts in the
device test tree.

Fatal build and run Python errors fixed.

The last update to xunitmerge is ~5 years ago, so it looks to be
unsupported now.

Use a local copy of the two components to allow patching to work with
Python3.

The serial test seems to send garbage chars (non-ASCII/etc.), so use a
codepage 437 which supports all 255 chars.

Fixes: #6660

* Run tests at 160MHz (req'd for some SSL connections)

* Fix debuglevel options for builder

* Fix Python3 interpreter path in xunitmerge

* Remove virtualenv on "make clean"

* Add appropriate attribution, license to xunitmerge

Add like to the original sources with the author's license to the
copied/fixed xunitmerge files.
This commit is contained in:
Earle F. Philhower, III
2019-10-26 13:58:54 -07:00
committed by GitHub
parent 1e17dddd89
commit 41ba21613d
8 changed files with 232 additions and 27 deletions

View File

@ -1,10 +1,9 @@
from collections import OrderedDict
from mock_decorators import setup, teardown
from threading import Thread
from poster.encode import MultipartParam
from poster.encode import multipart_encode
from poster.streaminghttp import register_openers
import urllib2
from poster3.encode import MultipartParam
from poster3.encode import multipart_encode
from poster3.streaminghttp import register_openers
import urllib
def http_test(res, url, get=None, post=None):
@ -13,8 +12,8 @@ def http_test(res, url, get=None, post=None):
if get:
url += '?' + urllib.urlencode(get)
if post:
post = urllib.urlencode(post)
request = urllib2.urlopen(url, post, 2)
post = urllib.parse.quote(post)
request = urllib.request.urlopen(url, post, 2)
response = request.read()
except:
return 1
@ -60,8 +59,8 @@ def setup_http_upload(e):
register_openers()
p = MultipartParam("file", "0123456789abcdef", "test.txt", "text/plain; charset=utf8")
datagen, headers = multipart_encode( [("var4", "val with spaces"), p] )
request = urllib2.Request('http://etd.local/upload', datagen, headers)
response = urllib2.urlopen(request, None, 2).read()
request = urllib.request('http://etd.local/upload', datagen, headers)
response = urllib.request.urlopen(request, None, 2).read()
except:
return 1
if response != 'test.txt:16\nvar4 = val with spaces':