Skip to content

Commit

Permalink
all tests pass for py2.6 and py3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
lightstrike committed Dec 16, 2015
1 parent 73ed8ab commit c527772
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 56 deletions.
67 changes: 43 additions & 24 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,43 +1,62 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
lib
lib64
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.tox
.coverage.*
.cache
nosetests.xml
htmlcov
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# Sphinx documentation
docs/_build/

# Complexity
output/*.html
output/*/index.html
# PyBuilder
target/

# Sphinx
docs/_build
# vim swap
*.sw*
54 changes: 28 additions & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
# Config file for automatic testing at travis-ci.org
# This file will be regenerated if you run travis_pypi_setup.py

language: python

env:
- TOXENV=py34
- TOXENV=py33
- TOXENV=py27
- TOXENV=py26
- TOXENV=pypy

# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
install: pip install -U tox

# command to run tests, e.g. python setup.py test
script: tox

# After you create the Github repo and add it to Travis, run the
# travis_pypi_setup.py script to finish PyPI deployment setup
# This file was autogenerated and will overwrite each time you run travis_pypi_setup.py
deploy:
provider: pypi
distributions: sdist bdist_wheel
user: lightstrike
provider: pypi
password:
secure: PLE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ENV=py33
- TOXENV=py27
- TOXENV=py26
- TOXENV=pypy
install: pip install -U tox
language: python
script: tox
7 changes: 6 additions & 1 deletion djeff/djeff.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@ def __init__(self, convert_charrefs=True, *args, **kwargs):
See:
https://docs.python.org/3/library/html.parser.html#html.parser.HTMLParser
"""
HTMLParser.__init__(self, convert_charrefs=convert_charrefs)
# python 3
try:
HTMLParser.__init__(self, convert_charrefs=convert_charrefs)
# python 2
except TypeError:
HTMLParser.__init__(self)
self.djhtml = ''

def handle_starttag(self, tag, attrs):
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
django==1.8.7
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py26, py27, py33, py34
envlist = py27, py34

[testenv]
setenv =
Expand All @@ -8,5 +8,5 @@ commands = python setup.py test

; If you want to make tox run the tests with the same versions, create a
; requirements.txt with the pinned versions and uncomment the following lines:
; deps =
; -r{toxinidir}/requirements.txt
deps =
-r{toxinidir}/requirements.txt
5 changes: 3 additions & 2 deletions travis_pypi_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def fetch_public_key(repo):
Travis API docs: http://docs.travis-ci.com/api/#repository-keys
"""
keyurl = 'https://api.travis-ci.org/repos/{0}/key'.format(repo)
data = json.loads(urlopen(keyurl).read())
data = json.loads(urlopen(keyurl).read().decode())
if 'key' not in data:
errmsg = "Could not find public key for repo: {}.\n".format(repo)
errmsg += "Have you already added your GitHub repo to Travis?"
Expand Down Expand Up @@ -106,7 +106,8 @@ def update_travis_deploy_password(encrypted_password):
def main(args):
public_key = fetch_public_key(args.repo)
password = args.password or getpass('PyPI password: ')
update_travis_deploy_password(encrypt(public_key, password))
update_travis_deploy_password(
encrypt(public_key, bytes(password.encode('utf-8'))))
print("Wrote encrypted password to .travis.yml -- you're ready to deploy")


Expand Down

0 comments on commit c527772

Please sign in to comment.