Skip to content

Commit 56a95c3

Browse files
committed
Update tox, dropping Python 2.6 and Python 3.3 but adding 3.5 and 3.6.
Also update a test to ensure 100% test module coverage.
1 parent cddb3a1 commit 56a95c3

File tree

3 files changed

+18
-27
lines changed

3 files changed

+18
-27
lines changed

TESTING.rst

+8-10
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@ Testing
33

44
First, install tox into your virtualenv::
55

6-
pip install -U tox
6+
pip install --upgrade tox
77

8-
To run all the qrcode tests, you'll need to install the older Python
9-
interpreters. Here's how you'll do it on a modern Ubuntu distribution::
8+
To run all tests, you'll need to install multiple Python interpreters. On a
9+
modern Ubuntu distribution you can use ``add-apt-repository
10+
ppa:deadsnakes/ppa``.
1011

11-
sudo add-apt-repository ppa:deadsnakes/ppa
12-
sudo apt-get update
13-
sudo apt-get install python2.4-dev python2.6-dev
12+
Depending on if you can install the wheels directly for your OS, you may need
13+
the libraries to build PIL, too. Here's the Ubuntu commands::
1414

15-
Ensure you have the libraries to build PIL, too::
16-
17-
sudo apt-get install build-essential python-dev python3-dev
15+
sudo apt-get install build-essential python-dev python3-dev
1816
sudo apt-get install libjpeg8-dev zlib1g-dev
1917

2018
Finally, just run ``tox``!
21-
If you want, you can test against a specific version like this: ``tox -e py33``
19+
If you want, you can test against a specific version like this: ``tox -e py36``

qrcode/tests/test_script.py

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ def test_stdin_py3_unicodedecodeerror(self, mock_print_ascii):
4747
mock_stdin.buffer.read.return_value = 'testtext'
4848
mock_stdin.read.side_effect = bad_read
4949
with mock.patch('sys.stdin', mock_stdin):
50+
# sys.stdin.read() will raise an error...
51+
self.assertRaises(UnicodeDecodeError, sys.stdin.read)
52+
# ... but it won't be used now.
5053
main([])
5154
mock_print_ascii.assert_called_with(tty=True)
5255

tox.ini

+7-17
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[tox]
22
distribute = False
33
envlist =
4-
coverage_setup,
5-
py26, py27, py33, py34,
6-
readme,
4+
coverage_setup
5+
py{27,34,35,36}
6+
readme
77
coverage_report
8+
skip_missing_interpreters = True
89

910
[testenv]
1011
usedevelop = True
@@ -13,22 +14,10 @@ deps =
1314
pillow
1415
git+git://github.com/ojii/pymaging.git#egg=pymaging
1516
git+git://github.com/ojii/pymaging-png.git#egg=pymaging-png
17+
py27: mock
1618
commands =
1719
{envbindir}/coverage run -a --source qrcode -m unittest {posargs:discover qrcode}
1820

19-
[testenv:py27]
20-
deps =
21-
{[testenv]deps}
22-
mock
23-
24-
[testenv:py26]
25-
deps =
26-
{[testenv:py27]deps}
27-
unittest2
28-
lxml
29-
commands =
30-
{envbindir}/coverage run -a --source qrcode {envbindir}/unit2 {posargs:discover qrcode}
31-
3221
[testenv:readme]
3322
deps =
3423
docutils
@@ -47,4 +36,5 @@ deps =
4736
coverage
4837
commands =
4938
coverage html
50-
coverage report --fail-under=90 -m
39+
coverage report --include="qrcode/tests/*" --fail-under=100 -m
40+
coverage report --omit="qrcode/tests/*" --fail-under=90 -m

0 commit comments

Comments
 (0)