View Issue Details

IDProjectCategoryView StatusLast Update
0005142GNUnetbuild processpublic2018-06-06 22:24
Reporternikita Assigned Tonikita Due Date
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product VersionGit master 
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

nikita

2017-10-01 19:30

reporter   ~0012455

A search for exactly this message gives me:

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

nikita

2017-10-01 19:42

reporter   ~0012456

Last edited: 2017-10-01 21:42

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

nikita

2017-10-02 07:10

reporter   ~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 13: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!)

nikita

2017-10-04 21:15

reporter   ~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.

nikita

2017-10-08 14:07

reporter   ~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 19:04

manager   ~0012470

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

nikita

2017-10-28 10:52

reporter   ~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.

nikita

2017-11-18 17:58

reporter   ~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.

nikita

2017-11-25 10:27

reporter   ~0012599

Last edited: 2017-11-25 10:28

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

nikita

2017-11-25 21:00

reporter   ~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 21: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.

nikita

2018-01-03 17:25

reporter   ~0012717

Original issue resolved, builds okay on HEAD.

Issue History

Date ModifiedUsernameFieldChange
2017-09-30 12:18nikitaNew Issue
2017-09-30 12:18nikitaSummarytest_dht_tools.py fails on 6570a7980a945cd3e6484baa8777512506b9ba49 => test_dht_tools.py fails on commit 6570a7980a945cd3e6484baa8777512506b9ba49
2017-10-01 19:30nikitaNote Added: 0012455
2017-10-01 19:42nikitaNote Added: 0012456
2017-10-01 20:17nikitaAssigned To => nikita
2017-10-01 20:17nikitaStatusnew => acknowledged
2017-10-01 20:35nikitaStatusacknowledged => confirmed
2017-10-01 21:42nikitaNote Edited: 0012456
2017-10-02 07:10nikitaNote Added: 0012457
2017-10-04 13:25Christian GrothoffNote Added: 0012461
2017-10-04 21:15nikitaNote Added: 0012463
2017-10-08 14:07nikitaNote Added: 0012466
2017-10-09 19:04Christian GrothoffNote Added: 0012470
2017-10-28 10:52nikitaNote Added: 0012519
2017-11-18 17:58nikitaNote Added: 0012583
2017-11-25 10:27nikitaNote Added: 0012599
2017-11-25 10:27nikitaAssigned Tonikita => Christian Grothoff
2017-11-25 10:28nikitaNote Edited: 0012599
2017-11-25 21:00nikitaNote Added: 0012600
2017-11-25 21:03Christian GrothoffNote Added: 0012601
2017-11-25 21:03Christian GrothoffAssigned ToChristian Grothoff => nikita
2018-01-03 17:25nikitaStatusconfirmed => resolved
2018-01-03 17:25nikitaResolutionopen => fixed
2018-01-03 17:25nikitaFixed in Version => Git master
2018-01-03 17:25nikitaNote Added: 0012717
2018-06-05 20:26Christian GrothoffProduct Version => Git master
2018-06-05 20:26Christian GrothoffFixed in VersionGit master => 0.11.0pre66
2018-06-05 20:26Christian GrothoffTarget Version => 0.11.0pre66
2018-06-06 22:24Christian GrothoffStatusresolved => closed