global-include Makefile* *.py *.txt
include ANNOUNCE ChangeLog MANIFEST.in TODO
-include mimedecode.docbook mimedecode.man mimedecode.html mk-distr
+include mimedecode.docbook mimedecode.man mimedecode.html
+include mk-distr tox.ini
include test/.mailcap test/README test/test_all
--- /dev/null
+tox >= 1.8
.PHONY: all
all:
- PYTHON=python2 ./test_all
- PYTHON=python3 ./test_all
+ ./test_all
.PHONY: clean
import sys
from m_lib.net.www.html import HTMLFilter
-with open(sys.argv[1], 'r') as f:
- html = f.read()
+PY2 = sys.version_info[0] < 3
+if PY2:
+ with open(sys.argv[1], 'r') as f:
+ html = f.read()
+else:
+ with open(sys.argv[1], 'r', encoding='utf-8') as f:
+ html = f.read()
filter = HTMLFilter()
filter.feed(html)
filter.close()
-print(filter.accumulator)
+if PY2:
+ print(filter.accumulator)
+else:
+ if not isinstance(filter.accumulator, bytes):
+ filter.accumulator = filter.accumulator.encode('utf-8')
+ sys.stdout.buffer.write(filter.accumulator + b'\n')
#! /bin/sh
cd "`dirname \"$0\"`" &&
-MAILCAPS="`pwd`"/.mailcap &&
-export MAILCAPS &&
-
rm -rf save tmp &&
mkdir tmp || exit 1
+LC_CTYPE=c.UTF-8 &&
+export LC_CTYPE &&
+
+MAILCAPS="`pwd`"/.mailcap &&
+export MAILCAPS &&
+
+: ${PYTHON:=python}
RC=0
+
if [ `$PYTHON -c "import sys; print(sys.version[0])"` -eq 2 ]; then
PY3=NO
else
--- /dev/null
+# Tox (http://tox.testrun.org/) is a tool for running tests
+# in multiple virtualenvs. This configuration file will run the
+# test suite on all supported python versions. To use it, "pip install tox"
+# and then run "tox" from this directory.
+
+[tox]
+envlist = py27, py33, py34, py35, py36, pypy
+skip_missing_interpreters=true
+toxworkdir={homedir}/.tox/mimedecode
+
+[testenv]
+basepython =
+ py27: {env:TOXPYTHON:python2.7}
+ py33: {env:TOXPYTHON:python3.3}
+ py34: {env:TOXPYTHON:python3.4}
+ py35: {env:TOXPYTHON:python3.5}
+ py36: {env:TOXPYTHON:python3.6}
+ pypy: {env:TOXPYTHON:pypy}
+deps =
+ -rdevscripts/requirements/requirements_tests.txt
+changedir = test
+commands =
+ {envpython} --version
+ {envpython} -c "import struct; print(struct.calcsize('P') * 8)"
+ ./test_all
+#whitelist_externals =