Skip to content

Commit 7da17ad

Browse files
committed
Improve pytest configuration to allow specific tests as CLI args
The previous test configuration made it difficult to run a single test with the pytest CLI. There were two major issues: - The Tests directory was not a package. It now includes a __init__.py file and imports from other tests modules are done with relative imports. - setup.cfg always specified the Tests directory. So even if a specific test were specified as a CLI arg, this configuration would also always include all tests. This configuration has been removed to allow specifying a single test on the command line. Contributors can now run specific tests with a single command such as: $ tox -e py37 -- Tests/test_file_pdf.py::TestFilePdf.test_rgb This makes it easy and faster to iterate on a single test failure and is very familiar to those that have previously used tox and pytest. When running tox or pytest with no arguments, they still discover and runs all tests in the Tests directory.
1 parent b62ff51 commit 7da17ad

File tree

161 files changed

+167
-170
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+167
-170
lines changed

Tests/__init__.py

Whitespace-only changes.

Tests/bench_cffi_access.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from helper import unittest, PillowTestCase, hopper
1+
from .helper import unittest, PillowTestCase, hopper
22

33
# Not running this test by default. No DOS against Travis CI.
44

Tests/bench_get.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import helper
1+
from . import helper
22
import timeit
33

44
import sys

Tests/check_fli_overflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from helper import unittest, PillowTestCase
1+
from .helper import unittest, PillowTestCase
22
from PIL import Image
33

44
TEST_FILE = "Tests/images/fli_overflow.fli"

Tests/check_imaging_leaks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python
22

33
from __future__ import division
4-
from helper import unittest, PillowTestCase
4+
from .helper import unittest, PillowTestCase
55
import sys
66
from PIL import Image
77

Tests/check_j2k_leaks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from helper import unittest, PillowTestCase
1+
from .helper import unittest, PillowTestCase
22
import sys
33
from PIL import Image
44
from io import BytesIO

Tests/check_j2k_overflow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from PIL import Image
2-
from helper import unittest, PillowTestCase
2+
from .helper import unittest, PillowTestCase
33

44

55
class TestJ2kEncodeOverflow(PillowTestCase):

Tests/check_jpeg_leaks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from helper import unittest, PillowTestCase, hopper
1+
from .helper import unittest, PillowTestCase, hopper
22
from io import BytesIO
33
import sys
44

Tests/check_large_memory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22

3-
from helper import unittest, PillowTestCase
3+
from .helper import unittest, PillowTestCase
44

55
# This test is not run automatically.
66
#

Tests/check_large_memory_numpy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22

3-
from helper import unittest, PillowTestCase
3+
from .helper import unittest, PillowTestCase
44

55
# This test is not run automatically.
66
#

0 commit comments

Comments
 (0)