Skip to content

Commit

Permalink
Merge pull request #39 from stchris/feature/flake8
Browse files Browse the repository at this point in the history
Feature/flake8
  • Loading branch information
Christian Stefanescu authored May 7, 2017
2 parents 5880a93 + 4360e04 commit 2119763
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 7 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ python:
- pypy
install:
- pip install coveralls
- pip install tox
script:
coverage run --source=untangle ./setup.py test

Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Changelog
---------

Unreleased
- flake8 now runs as part of the unit tests. Fully replaced nose with tox as a test runner.

1.1.1
- addded generic SAX feature toggle ([#26](https://github.com/stchris/untangle/pull/26))
- added support for `hasattribute`/`getattribute` ([#15](https://github.com/stchris/untangle/pull/15))
Expand Down
1 change: 1 addition & 0 deletions examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def access_cdata():
)
return ("%s" % (o.node.cdata))


examples = [
('Access children with parent.children and'
' attributes with element["attribute"]', access),
Expand Down
3 changes: 1 addition & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from setuptools import setup

if sys.argv[-1] == 'test':
os.system('nosetests tests/tests.py')
os.system('tox')
sys.exit()

setup(
Expand All @@ -54,7 +54,6 @@
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
),
test_suite = 'nose.collector'
)

# vim: set expandtab ts=4 sw=4:
4 changes: 2 additions & 2 deletions tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def test_namespace(self):
template.table.tr.xsl_for_each.td['class']
)
self.assertEquals(
untangle.Element('',''),
untangle.Element('', ''),
template.table.tr.xsl_for_each.td.xsl_apply_templates
)

Expand All @@ -185,7 +185,7 @@ def test_namespace(self):
last_template.p['class']
)
self.assertEquals(
untangle.Element('xsl_apply_templates',''),
untangle.Element('xsl_apply_templates', ''),
last_template.p.xsl_apply_templates
)

Expand Down
10 changes: 9 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@
# and then run "tox" from this directory.

[tox]
envlist = py26, py27, py33, py34, py35, py36, pypy
envlist = flake8, py26, py27, py33, py34, py35, py36, pypy
skip_missing_interpreters = true

[testenv]
commands = py.test tests/tests.py
deps = pytest

[testenv:flake8]
basepython=python
deps=flake8
commands=flake8 .

[flake8]
exclude = .git,__pycache__,docs/conf.py,old,build,dist,.tox
7 changes: 5 additions & 2 deletions untangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@
from io import StringIO
try:
from types import StringTypes
is_string = lambda x: isinstance(x, StringTypes)

def is_string(x):
return isinstance(x, StringTypes)
except ImportError:
is_string = lambda x: isinstance(x, str)
def is_string(x):
return isinstance(x, str)

__version__ = '1.1.1'

Expand Down

0 comments on commit 2119763

Please sign in to comment.