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

Python 3 support #9

Merged
merged 8 commits into from
Aug 3, 2017
Merged

Python 3 support #9

merged 8 commits into from
Aug 3, 2017

Conversation

aldanor
Copy link
Contributor

@aldanor aldanor commented Aug 2, 2017

Fixes #7.

Copy link
Contributor

@jaraco jaraco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for putting this together. I just have a few small nitpicks.

tox.ini Outdated
@@ -1,7 +1,8 @@
[tox]
minversion = 2.4
envlist = py{2.7,3.6}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather not specify the Python versions here, as some environments may not have these versions. Let's just specify the target versions in Travis and let tox run against the local python version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough; I guess this requires appending - 3.6 to python: in .travis.yml then?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, hopefully Travis will pick it up

tox.ini Outdated

[testenv]
changedir = test
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do the tests work without this change (keeping usedevelop)? I've found usedevelop is necessary for some packages, and I'd rather diverge as little as possible from the scaffolding that other projects need.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will check.

// Doing in-place tests is usually a bad idea since it doesn't test that you've actually packaged things properly (or messed up the imports), since your code will not be imported the same way as the end users will do it. Most often than not, changedir to a folder that doesn't contain __init__.py isolates the test code from the the source tree and ensures you're testing against site-packages.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting point. I do agree that's a risk... and perhaps your technique is indeed superior. I do struggle a little bit with it for several reasons: (1) not all projects have a 'tests' directory, so to generalize the technique, one would need to create this directory. (2) pytest would only discover tests in this directory, meaning all tests would need to be moved to this directory, which isn't even possible for some tests like doctests and (3) When running tests against installed packages, they end up getting long, bulky paths in the traceback instead of the nearby local paths fuzzy vs .tox/envname/lib/pythonN.N/site-packages/fuzzy (maybe even absolute).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, I've reverted it for now.

import ctypes

import fuzzy

def test_soundex_does_not_mutate_strings():
phrase = 'FancyFree'
phrase = u'FancyFree'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u'' syntax is unnecessary and superfluous when unicode_literals is present.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. Yea, indeed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@@ -1,1657 +0,0 @@
/* Generated by Pyrex 0.9.8.6 on Sat Feb 4 15:03:10 2012 */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it's nice to omit the generated code, it's necessary to create sdists that can be installed without Cython, which presumably was a goal at one point. I'm happy to omit this file, but we should be explicit about which installations this might break and how to mitigate the effects.

@jaraco jaraco merged commit bdb2890 into yougov:master Aug 3, 2017
jaraco pushed a commit that referenced this pull request Aug 3, 2017
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.

None yet

2 participants