From af261e3c94308095ad3c89c64ead144a6c5e4831 Mon Sep 17 00:00:00 2001 From: Christian Stefanescu Date: Sun, 7 May 2017 13:34:34 +0200 Subject: [PATCH 1/3] Run flake8 from tox Also removed any reference to nose. --- examples.py | 1 + setup.py | 3 +-- tests/tests.py | 4 ++-- tox.ini | 10 +++++++++- untangle.py | 7 +++++-- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/examples.py b/examples.py index 3c5b859..71fddc0 100755 --- a/examples.py +++ b/examples.py @@ -41,6 +41,7 @@ def access_cdata(): ) return ("%s" % (o.node.cdata)) + examples = [ ('Access children with parent.children and' ' attributes with element["attribute"]', access), diff --git a/setup.py b/setup.py index c82f2c8..1863b39 100755 --- a/setup.py +++ b/setup.py @@ -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( @@ -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: diff --git a/tests/tests.py b/tests/tests.py index a76e527..76a1ef4 100755 --- a/tests/tests.py +++ b/tests/tests.py @@ -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 ) @@ -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 ) diff --git a/tox.ini b/tox.ini index f73dc04..40d7200 100644 --- a/tox.ini +++ b/tox.ini @@ -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 diff --git a/untangle.py b/untangle.py index 361c54c..1263056 100755 --- a/untangle.py +++ b/untangle.py @@ -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' From c23766491c52307d2accfcb9d280aecbc2e59069 Mon Sep 17 00:00:00 2001 From: Christian Stefanescu Date: Sun, 7 May 2017 13:35:58 +0200 Subject: [PATCH 2/3] Added changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fc2d03..b5781f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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)) From 4360e048e8e20fb8e4de7c9f7070b58843bf83fb Mon Sep 17 00:00:00 2001 From: Christian Stefanescu Date: Sun, 7 May 2017 13:41:22 +0200 Subject: [PATCH 3/3] Install tox on travis --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 411ce7e..00aed3b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,6 +9,7 @@ python: - pypy install: - pip install coveralls + - pip install tox script: coverage run --source=untangle ./setup.py test