Skip to content
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

Add installation and test support for python3. #406

Merged
merged 14 commits into from
Nov 9, 2016

Conversation

ryneeverett
Copy link
Collaborator

This is a rebase and update of @wfranzini's work in #387. We had a remarkable number of merge conflicts in such a short time.

This is great progress on #25, but I think we ought to do significant manual testing before closing that issue and declaring python3 compatibility 'done'.

@gdetrez
Copy link
Collaborator

gdetrez commented Oct 24, 2016

I give this a try and I can confirm that pip-insallation works as do some simple tests I ran with gitlab and trello. 👍

Github seems to work with a plain text token in bugwarriorrc but when using an oracle, I got the following crash:

Worker for [bnfc] failed: Can't convert 'bytes' object to str implicitly
Traceback (most recent call last):
  File "/home/gregoire/QA/bugwarrior/ENV-3.5/lib/python3.5/site-packages/bugwarrior/services/__init__.py", line 516, in _aggregate_issues
    service = get_service(service_name)(conf, main_section, target)
  File "/home/gregoire/QA/bugwarrior/ENV-3.5/lib/python3.5/site-packages/bugwarrior/services/github.py", line 234, in __init__
    self.client = GithubClient(auth)
  File "/home/gregoire/QA/bugwarrior/ENV-3.5/lib/python3.5/site-packages/bugwarrior/services/github.py", line 20, in __init__
    authorization = 'token ' + self.auth['token']
TypeError: Can't convert 'bytes' object to str implicitly

I'm using the eval oracle and I'm guessing that the result of the executed command is returned as bytes in self.auth['token'], whereas the 'token' constant in github.py is a unicode str in python 3.

@ryneeverett
Copy link
Collaborator Author

@gdetrez I'm not surprised there are python3 bugs. As long as there aren't python2 regressions though, I'd like to go ahead and merge this and deal with python3 bugs that the test suite doesn't catch in future PR's. (And add the missing tests when feasible.) Any objections to merging as is?

@wfranzini
Copy link

@ryneeverett the following code added to test_github.py catch the bug:

class TestGithubIssueToken(TestGithubIssue):
    SERVICE_CONFIG = {
        'github.login': 'arbitrary_login',
        'github.token': '@oracle:eval:python -c "print(\'secret\')"',
        'github.username': 'arbitrary_username',
    }

Maybe this approach can be improved and expanded to the testsuite using parameterized test.

@gdetrez
Copy link
Collaborator

gdetrez commented Oct 25, 2016

@ryneeverett I don't have an objection to merging this now and fixing issues later. But I think @ralphbean wanted to make a new release (#339) in which case it might be safer to merge this PR after. But #339 haven't been updated since July so I don't know if it is still happening.

@ryneeverett
Copy link
Collaborator Author

@gdetrez Agreed. I'll give @ralphbean a few days to respond, but if we don't hear anything I for a bit I may go ahead and merge. It would be a lot simpler to make new PR's 2-to-3 compatible than to keep fixing and rebasing this branch.

@ryneeverett ryneeverett mentioned this pull request Oct 25, 2016
@ryneeverett ryneeverett merged commit 9d3d689 into GothenburgBitFactory:develop Nov 9, 2016
@ralphbean
Copy link
Collaborator

But #339 haven't been updated since July so I don't know if it is still happening.

Yeah, sorry I've been MIA.

I'm getting some py2 regressions with this:

Python 2.7.12 (default, Sep 29 2016, 12:52:02) 
[GCC 6.2.1 20160916 (Red Hat 6.2.1-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from future import standard_library
>>> standard_library.install_aliases()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/threebean/.virtualenvs/bugwarrior/lib/python2.7/site-packages/future-0.16.0-py2.7.egg/future/standard_library/__init__.py", line 483, in install_aliases
    import test
  File "test.py", line 5, in <module>
    with open('/tmp/npm.txt', 'rb') as npm_file:
IOError: [Errno 2] No such file or directory: '/tmp/npm.txt'

Anybody else seeing this?

@ralphbean
Copy link
Collaborator

Looks like I only get that failure with future==0.16.0, the 0.15.2 release is a little better?

ralphbean added a commit that referenced this pull request Nov 9, 2016
This version is giving us problems.  See discussion in #406.
@ralphbean
Copy link
Collaborator

@irl, have you looked at packaging future for debian? It is non-trivial: https://bugzilla.redhat.com/show_bug.cgi?id=1393502

@ryneeverett
Copy link
Collaborator Author

Thanks for fixing the build @ralphbean! I had no idea what the problem was but I learned the hard way that doing a github rebase-merge breaks the ability to auto-revert a PR.

ryneeverett added a commit to ryneeverett/bugwarrior that referenced this pull request Nov 9, 2016
This adds the test proposed by @wfranzini and fixes the TypeError
reported by @gdetrez in GothenburgBitFactory#406 (TypeError: Can't convert 'bytes' object to
str implicitly).
ryneeverett added a commit to ryneeverett/bugwarrior that referenced this pull request Nov 9, 2016
This adds the test proposed by @wfranzini and fixes the TypeError
reported by @gdetrez in GothenburgBitFactory#406 (TypeError: Can't convert 'bytes' object to
str implicitly).
ryneeverett added a commit to ryneeverett/bugwarrior that referenced this pull request Dec 2, 2016
This adds the test proposed by @wfranzini and fixes the TypeError
reported by @gdetrez in GothenburgBitFactory#406 (TypeError: Can't convert 'bytes' object to
str implicitly).
ryneeverett added a commit to ryneeverett/bugwarrior that referenced this pull request Dec 2, 2016
This adds the test proposed by @wfranzini and fixes the TypeError
reported by @gdetrez in GothenburgBitFactory#406 (TypeError: Can't convert 'bytes' object to
str implicitly).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants