diff --git a/.gitignore b/.gitignore
index b92d662..688bd6a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,5 @@
build/
*.pyc
+.tox/
+.cache/
+*.egg-info/
diff --git a/.travis.yml b/.travis.yml
index d1ad0ae..67cb5a4 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1 +1,11 @@
language: python
+python:
+ - 2.7
+ - 3.3
+ - 3.4
+ - 3.5
+ - 3.6
+install:
+ - pip install tox-travis
+script:
+ - tox
diff --git a/HOWTODIST b/HOWTODIST
index b241e79..291898c 100644
--- a/HOWTODIST
+++ b/HOWTODIST
@@ -11,7 +11,13 @@ $ cd odfpy
Run the automated tests:
-$ cd tests ; make ; cd ..
+Install `tox` via `pip` when running the tests for the first time:
+
+$ pip install tox
+
+Run the tests for all supported python versions:
+
+$ tox
Remove the "dev" marker from the version in setup.py and odf/namespaces.py
diff --git a/setup b/setup
deleted file mode 100644
index 3c6e79c..0000000
--- a/setup
+++ /dev/null
@@ -1,2 +0,0 @@
-[bdist_wheel]
-universal=1
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..1935cf0
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,7 @@
+[bdist_wheel]
+universal=1
+
+[tool:pytest]
+norecursedirs = grammar
+addopts = tests
+python_files = test*.py
diff --git a/tests/Makefile b/tests/Makefile
deleted file mode 100644
index 7d57de3..0000000
--- a/tests/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
-all: odf runall
-
-runall:
- ./runtests
-
-odf:
- ln -s ../odf
-
-clean:
- rm -f *.1 *.txt odf
diff --git a/tests/runtests b/tests/runtests
deleted file mode 100755
index ffa3a8f..0000000
--- a/tests/runtests
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-echo '========= Python 2 tests =========='
-for file in test*.py
-do
- python2 $file
-done
-
-echo '========= Python 3 tests =========='
-for file in test*.py
-do
- python3 $file
-done
diff --git a/tests/teststyles.py b/tests/teststyles.py
index e9c318b..cca8b93 100644
--- a/tests/teststyles.py
+++ b/tests/teststyles.py
@@ -88,8 +88,8 @@ def testAttributeForeign(self):
textdoc.styles.addElement(standard)
s = textdoc.stylesxml()
s.index(u"""\n""")
- s.index(u'xmlns:ns41="http://foreignuri.com"')
- s.index(u'')
+ s.index(u'xmlns:ns44="http://foreignuri.com"')
+ s.index(u'')
e = ElementParser(s,u'style:style')
# e = ElementParser('')
self.assertEqual(e.element,u'style:style')
diff --git a/tests/testunicode.py b/tests/testunicode.py
index b3e2cc7..5890bcc 100644
--- a/tests/testunicode.py
+++ b/tests/testunicode.py
@@ -40,6 +40,8 @@ def assertContains(self, stack, needle):
def assertNotContains(self, stack, needle):
self.assertEqual(-1, stack.find(needle))
+ @unittest.skipIf(sys.version_info[0] != 2,
+ "For Python3, unicode strings are type 'str'.")
def test_xstyle(self):
self.assertRaises(UnicodeDecodeError, style.Style, name="X✗", family="paragraph")
xstyle = style.Style(name=u"X✗", family=u"paragraph")
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..39bde93
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,13 @@
+[tox]
+envlist =
+ py27,
+ py33,
+ py34,
+ py35,
+ py36,
+
+[testenv]
+commands =
+ pytest
+deps =
+ pytest