New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[qa] py2: Unfiddle strings into bytes explicitly #7853

Merged
merged 1 commit into from Apr 14, 2016

Conversation

Projects
None yet
3 participants
@MarcoFalke
Member

MarcoFalke commented Apr 10, 2016

This will explicitly mark most strings as bytes. (Required for py3)

@laanwj laanwj added the Tests label Apr 11, 2016

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Apr 11, 2016

Member

Awesome, this is the shittiest part of porting to Python 3.
Concept ACK.

Member

laanwj commented Apr 11, 2016

Awesome, this is the shittiest part of porting to Python 3.
Concept ACK.

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj
Member

laanwj commented Apr 14, 2016

tACK faa41ee

@laanwj laanwj merged commit faa41ee into bitcoin:master Apr 14, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

laanwj added a commit that referenced this pull request Apr 14, 2016

Merge #7853: [qa] py2: Unfiddle strings into bytes explicitly
faa41ee [qa] py2: Unfiddle strings into bytes explicitly (MarcoFalke)
@mruddy

This comment has been minimized.

Show comment
Hide comment
@mruddy

mruddy Apr 14, 2016

Contributor

@MarcoFalke

i noticed a new error when running make check:

Running test/bitcoin-util-test.py...
Traceback (most recent call last):
  File "./test/bitcoin-util-test.py", line 12, in <module>
    "bitcoin-util-test.json",buildenv)
  File "/home/black/Desktop/bitcoin/src/test/bctest.py", line 52, in bctester
    bctest(testDir, testObj, buildenv.exeext)
  File "/home/black/Desktop/bitcoin/src/test/bctest.py", line 30, in bctest
    outs = proc.communicate(input=inputData)
  File "/usr/lib/python3.4/subprocess.py", line 962, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/usr/lib/python3.4/subprocess.py", line 1601, in _communicate
    self._save_input(input)
  File "/usr/lib/python3.4/subprocess.py", line 1677, in _save_input
    self._input = self._input.encode(self.stdin.encoding)
AttributeError: 'bytes' object has no attribute 'encode'

this makes the error go away, but is probably not what you want since it only undoes one of this PR's changes:

diff --git a/src/test/bctest.py b/src/test/bctest.py
index fc59152..dbff278 100644
--- a/src/test/bctest.py
+++ b/src/test/bctest.py
@@ -17,7 +17,7 @@ def bctest(testDir, testObj, exeext):
        inputData = None
        if "input" in testObj:
                filename = testDir + "/" + testObj['input']
-               inputData = open(filename, 'rb').read()
+               inputData = open(filename).read()
                stdinCfg = subprocess.PIPE

        outputFn = None
Contributor

mruddy commented Apr 14, 2016

@MarcoFalke

i noticed a new error when running make check:

Running test/bitcoin-util-test.py...
Traceback (most recent call last):
  File "./test/bitcoin-util-test.py", line 12, in <module>
    "bitcoin-util-test.json",buildenv)
  File "/home/black/Desktop/bitcoin/src/test/bctest.py", line 52, in bctester
    bctest(testDir, testObj, buildenv.exeext)
  File "/home/black/Desktop/bitcoin/src/test/bctest.py", line 30, in bctest
    outs = proc.communicate(input=inputData)
  File "/usr/lib/python3.4/subprocess.py", line 962, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
  File "/usr/lib/python3.4/subprocess.py", line 1601, in _communicate
    self._save_input(input)
  File "/usr/lib/python3.4/subprocess.py", line 1677, in _save_input
    self._input = self._input.encode(self.stdin.encoding)
AttributeError: 'bytes' object has no attribute 'encode'

this makes the error go away, but is probably not what you want since it only undoes one of this PR's changes:

diff --git a/src/test/bctest.py b/src/test/bctest.py
index fc59152..dbff278 100644
--- a/src/test/bctest.py
+++ b/src/test/bctest.py
@@ -17,7 +17,7 @@ def bctest(testDir, testObj, exeext):
        inputData = None
        if "input" in testObj:
                filename = testDir + "/" + testObj['input']
-               inputData = open(filename, 'rb').read()
+               inputData = open(filename).read()
                stdinCfg = subprocess.PIPE

        outputFn = None

@MarcoFalke MarcoFalke deleted the MarcoFalke:Mf1604-qaBytes branch Apr 14, 2016

@MarcoFalke

This comment has been minimized.

Show comment
Hide comment
@MarcoFalke

MarcoFalke Apr 14, 2016

Member

@mruddy Thanks for reporting, I will take a look...

Member

MarcoFalke commented Apr 14, 2016

@mruddy Thanks for reporting, I will take a look...

MarcoFalke added a commit to MarcoFalke/bitcoin that referenced this pull request Apr 15, 2016

[qa] py2: Unfiddle strings into bytes explicitly
Github-Pull: #7853
Rebased-From: faa41ee, fa7abe0

 Conflicts:
	qa/rpc-tests/invalidtxrequest.py
	qa/rpc-tests/p2p-feefilter.py
	qa/rpc-tests/proxy_test.py
	qa/rpc-tests/test_framework/mininode.py
	qa/rpc-tests/test_framework/netutil.py
	src/test/bctest.py

zander added a commit to zander/bitcoinclassic that referenced this pull request Jun 16, 2016

[qa] py2: Unfiddle strings into bytes explicitly
Github-Pull: #7853
Rebased-From: faa41ee, fa7abe0

 Conflicts:
	qa/rpc-tests/invalidtxrequest.py
	qa/rpc-tests/p2p-feefilter.py
	qa/rpc-tests/proxy_test.py
	qa/rpc-tests/test_framework/mininode.py
	qa/rpc-tests/test_framework/netutil.py
	src/test/bctest.py

nomnombtc added a commit to nomnombtc/bitcoin that referenced this pull request Nov 11, 2016

[qa] py2: Unfiddle strings into bytes explicitly
Github-Pull: #7853
Rebased-From: faa41ee, fa7abe0

 Conflicts:
	qa/rpc-tests/invalidtxrequest.py
	qa/rpc-tests/p2p-feefilter.py
	qa/rpc-tests/proxy_test.py
	qa/rpc-tests/test_framework/mininode.py
	qa/rpc-tests/test_framework/netutil.py
	src/test/bctest.py

nomnombtc added a commit to nomnombtc/bitcoin that referenced this pull request Nov 12, 2016

[qa] py2: Unfiddle strings into bytes explicitly
Github-Pull: #7853
Rebased-From: faa41ee, fa7abe0

 Conflicts:
	qa/rpc-tests/invalidtxrequest.py
	qa/rpc-tests/p2p-feefilter.py
	qa/rpc-tests/proxy_test.py
	qa/rpc-tests/test_framework/mininode.py
	qa/rpc-tests/test_framework/netutil.py
	src/test/bctest.py

nomnombtc added a commit to nomnombtc/bitcoin that referenced this pull request Nov 13, 2016

[qa] py2: Unfiddle strings into bytes explicitly
Github-Pull: #7853
Rebased-From: faa41ee, fa7abe0

 Conflicts:
	qa/rpc-tests/invalidtxrequest.py
	qa/rpc-tests/p2p-feefilter.py
	qa/rpc-tests/proxy_test.py
	qa/rpc-tests/test_framework/mininode.py
	qa/rpc-tests/test_framework/netutil.py
	src/test/bctest.py

str4d added a commit to str4d/zcash that referenced this pull request Jan 31, 2017

@str4d str4d referenced this pull request Jan 31, 2017

Merged

Add ZeroMQ notifications #2050

str4d added a commit to str4d/zcash that referenced this pull request Feb 8, 2017

zkbot added a commit to zcash/zcash that referenced this pull request Feb 9, 2017

zkbot added a commit to zcash/zcash that referenced this pull request Feb 9, 2017

zkbot added a commit to zcash/zcash that referenced this pull request Feb 9, 2017

@dagurval dagurval referenced this pull request Aug 29, 2017

Merged

Python 3 for qa #257

codablock added a commit to codablock/dash that referenced this pull request Sep 16, 2017

Merge #7853: [qa] py2: Unfiddle strings into bytes explicitly
faa41ee [qa] py2: Unfiddle strings into bytes explicitly (MarcoFalke)

codablock added a commit to codablock/dash that referenced this pull request Sep 19, 2017

Merge #7853: [qa] py2: Unfiddle strings into bytes explicitly
faa41ee [qa] py2: Unfiddle strings into bytes explicitly (MarcoFalke)

codablock added a commit to codablock/dash that referenced this pull request Dec 20, 2017

Add missing changes from Bitcoin #7853
Missed due to conflict resolution in out-of-order backports
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment