-
Notifications
You must be signed in to change notification settings - Fork 3
Python2 compat #2
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
Open
robin900
wants to merge
17
commits into
henrystokeley:master
Choose a base branch
from
robin900:python2-compat
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
fe4c720
python2 compatibility via six module and mock module for tests
2ce5614
Mention Python 2 compatibility
f7fee39
let's get travis-ci running
90352c3
omit pandas requirement when in Travis/CI mode.
0213428
typo in os.environ usage
7ac1638
handle python2 testing by upgrading setuptools
6e7e78a
-U
24da237
try different install syntax for multiple cmds
2bab7a6
add shim in test/__init__.py to create stub pandas module for testing
6ef693e
more terse pandas shim for all testing envs; avoid set literal
e14b812
factor out compat shim for test, use unittest2 for 2.6 compatibility
72aea87
de-six the compat shim, use unittest2 only for 2.6
3132558
last, exhausting step for 2.6 compatibility: string formatting only
63e9b11
Add travis status
3925e10
mention all tested Python versions
f0fafb2
ignore .eggs folder created by 2.6 builds
4b073f1
reference henrystokeley's (imminent) travis-ci build and tree
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,6 @@ __pycache__ | |
| build | ||
| dist | ||
| /pgsheets.egg-info | ||
|
|
||
| /.eggs | ||
| # environments | ||
| .env | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| language: python | ||
| python: | ||
| - 2.6 | ||
| - 2.7 | ||
| - 3.3 | ||
| - 3.4 | ||
| - 3.5 | ||
| install: | ||
| - pip install -U setuptools>=17.1 | ||
| - python setup.py install | ||
| script: python setup.py test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,3 @@ | ||
| pandas >= 0.14.0 | ||
| requests >= 2.0.0 | ||
| six |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| import sys, types | ||
| sys.modules['pandas'] = types.ModuleType('pandas', 'Fake pandas module') | ||
| del sys | ||
| del types | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| import sys | ||
| if sys.version_info[0] == 3: | ||
| from unittest import TestCase | ||
| from unittest.mock import patch | ||
| elif sys.version_info[0] == 2: | ||
| from mock import patch | ||
| if sys.version_info[1] < 7: | ||
| from unittest2 import TestCase | ||
| else: | ||
| from unittest import TestCase |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All tests pass and everything looks good, but can you explain why you're mocking out the pandas module? Even if it isn't required right now, shouldn't we still test against pandas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@robin900 ↑
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, I do not wish to attempt to get pandas to build on the travis-ci host. 1) Testing a collaborative open source package against multiple Python versions requires something like travis-ci, and 2) using travis-ci means we have to build each test environment from scratch for each build. There are ways to retain assets from build to build on a TravisCI instance, but it requires a paid subscription.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@henrystokeley ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, note that pandas is a requirement in setup.py UNLESS the environment indicates it's travis-ci or another CI. So installing and running the tests locally will still check for pandas requirement, and import the genuine pandas module.
If the test code ever grows tests that actually call pandas code, our choices seem to be:
I would vote for #3.