View Issue Details

IDProjectCategoryView StatusLast Update
0005142GNUnetbuild processpublic2018-06-07 00:24
Reporterng0Assigned Tong0 
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product VersionSVN HEAD 
Target Version0.11.0pre66Fixed in Version0.11.0pre66 
Summary0005142: test_dht_tools.py fails on commit 6570a7980a945cd3e6484baa8777512506b9ba49
Description===========================================
   gnunet 0.10.1: src/dht/test-suite.log
===========================================

# TOTAL: 5
# PASS: 4
# SKIP: 0
# XFAIL: 0
# FAIL: 1
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: test_dht_tools.py
=======================

TEST: Starting ARM...PASS
TEST: Testing put...PASS
TEST: Testing get...Traceback (most recent call last):
  File "./test_dht_tools.py", line 118, in <module>
    stdo = stdo.replace ('\r', '').splitlines ()
TypeError: a bytes-like object is required, not 'str'
FAIL test_dht_tools.py (exit status: 1)
TagsNo tags attached.

Activities

ng0

2017-10-01 21:30

developer   ~0012455

A search for exactly this message gives me:

https://stackoverflow.com/questions/33003498/typeerror-a-bytes-like-object-is-required-not-str

ng0

2017-10-01 21:42

developer   ~0012456

Last edited: 2017-10-01 23:42

View 2 revisions

Since python3.4 (?) it seems as if this applies (to '\n') to line 118:

"\n" (str type) is a Unicode string (text) that is not bytes-like (binary data) in Python 3.

https://docs.python.org/3/library/stdtypes.html#bytes.decode

https://docs.python.org/3/howto/unicode.html

https://docs.python.org/release/3.0.1/whatsnew/3.0.html#text-vs-data-instead-of-unicode-vs-8-bit

ng0

2017-10-02 09:10

developer   ~0012457

My python is slowly coming back to me.

I assumed this:

  stdo = stdo.replace('\r', '').splitlines().encode('utf-8')


would be enough, but this still produces:

  TypeError: a bytes-like object is required, not 'str'

Christian Grothoff

2017-10-04 15:25

manager   ~0012461

So this is a Python version issue? It doesn't fail on my system(s), so I assume I'm having the wrong Python version? (Fantastic, those stable languages!)

ng0

2017-10-04 23:15

developer   ~0012463

Yes.

My assumption was all of gnunet moved on to python3 - I am building it with python3 for a while now, to be precise 3.5 iirc - but this test case seems to indicate not all of the python files are there already.

ng0

2017-10-08 16:07

developer   ~0012466

Which python version do you use?

0.10.1 used to build with python-2.7.13 but at some point it was switched over to...
Oh. Apparently still 2.7.13 … so I assume we still use python2.
So why is this test failing?

Do we already have some of our less than 25 python scrips ported to python3? Do we want to do that at all?

Christian Grothoff

2017-10-09 21:04

manager   ~0012470

Just tested, my desktop (where it works) runs Python 2.7.13.

ng0

2017-10-28 12:52

developer   ~0012519

So we have two possible situations:

1. non-reproducible bug
2. an error in the python script

and also: assumptions in the script that weren't documented.

ng0

2017-11-18 18:58

developer   ~0012583

In my opinion we should consider getting rid of python or implement tests written in python (if we absolutely have to) in a way that there's no easy chance of 'works for me' scenarios.

ng0

2017-11-25 11:27

developer   ~0012599

Last edited: 2017-11-25 11:28

View 2 revisions

I have a different phase in the test failing now, after fixing up the first part of the python3 port:

===========================================
   gnunet 0.10.1: src/dht/test-suite.log
===========================================

# TOTAL: 5
# PASS: 4
# SKIP: 0
# XFAIL: 0
# FAIL: 1
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: test_dht_tools.py
=======================

TEST: Starting ARM...FAIL: expected error while running ['gnunet-arm', '-c', 'test_dht_api_peer1.conf', '-s']
Command output was:
None
None
FAIL test_dht_tools.py (exit status: 1)




Do you have an idea why it it returning None None? I'm reading the testcase but some insight on what's expected would help.

This is with the most recent state of https://gnunet.org/git/gnunet.git/log/?h=feature/python2-to-python3

ng0

2017-11-25 22:00

developer   ~0012600

I can't work with this. It's a seriously messed up (testsuite) codebase, I have moved on to the rewriting. With less code and better results maybe this issue fixes itself.
I'm not saying the code is bad, it's just very repetive and invents things that other modules already provide and comes up with too many helper functions.

Christian Grothoff

2017-11-25 22:03

manager   ~0012601

Go ahead, I can see that this py code is quite messy, ancient and ugly. A rewrite might be the best way to fix it properly.

ng0

2018-01-03 18:25

developer   ~0012717

Original issue resolved, builds okay on HEAD.

Issue History

Date Modified Username Field Change
2017-09-30 14:18 ng0 New Issue
2017-09-30 14:18 ng0 Summary test_dht_tools.py fails on 6570a7980a945cd3e6484baa8777512506b9ba49 => test_dht_tools.py fails on commit 6570a7980a945cd3e6484baa8777512506b9ba49
2017-10-01 21:30 ng0 Note Added: 0012455
2017-10-01 21:42 ng0 Note Added: 0012456
2017-10-01 22:17 ng0 Assigned To => ng0
2017-10-01 22:17 ng0 Status new => acknowledged
2017-10-01 22:35 ng0 Status acknowledged => confirmed
2017-10-01 23:42 ng0 Note Edited: 0012456 View Revisions
2017-10-02 09:10 ng0 Note Added: 0012457
2017-10-04 15:25 Christian Grothoff Note Added: 0012461
2017-10-04 23:15 ng0 Note Added: 0012463
2017-10-08 16:07 ng0 Note Added: 0012466
2017-10-09 21:04 Christian Grothoff Note Added: 0012470
2017-10-28 12:52 ng0 Note Added: 0012519
2017-11-18 18:58 ng0 Note Added: 0012583
2017-11-25 11:27 ng0 Note Added: 0012599
2017-11-25 11:27 ng0 Assigned To ng0 => Christian Grothoff
2017-11-25 11:28 ng0 Note Edited: 0012599 View Revisions
2017-11-25 22:00 ng0 Note Added: 0012600
2017-11-25 22:03 Christian Grothoff Note Added: 0012601
2017-11-25 22:03 Christian Grothoff Assigned To Christian Grothoff => ng0
2018-01-03 18:25 ng0 Status confirmed => resolved
2018-01-03 18:25 ng0 Resolution open => fixed
2018-01-03 18:25 ng0 Fixed in Version => SVN HEAD
2018-01-03 18:25 ng0 Note Added: 0012717
2018-06-05 22:26 Christian Grothoff Product Version => SVN HEAD
2018-06-05 22:26 Christian Grothoff Fixed in Version SVN HEAD => 0.11.0pre66
2018-06-05 22:26 Christian Grothoff Target Version => 0.11.0pre66
2018-06-07 00:24 Christian Grothoff Status resolved => closed