Skip to content

Commit

Permalink
Deprecation warning for Python 2; pytest<5 (#877)
Browse files Browse the repository at this point in the history
* Deprecation warning for Python 2
* Update test instructions to pytest<5 for Python 2
  • Loading branch information
darcymason authored and mrbean-bremen committed Jul 8, 2019
1 parent 57cb023 commit 2c8b11f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 3 additions & 1 deletion doc/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Prerequisites
* gdcm
* jpeg_ls
* jpeg2000
* pytest (if running pydicom's test suite)
* pytest (if running pydicom's test suite). pytest<5 if in Python 2.


Installing pydicom
Expand Down Expand Up @@ -139,6 +139,8 @@ pydicom's setup.py file and::

This will install `pytest <https://pytest.org>`_ if it is not
already installed.

In v1.3 run under Python 2, if pytest is not found, please `python2 -m pip install "pytest<5"`

Or, in linux you can also use::

Expand Down
6 changes: 6 additions & 0 deletions pydicom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,9 @@
'write_file',
'__version__',
'__version_info__']

from pydicom.compat import in_py2
if in_py2:
import warnings
msg = 'Python 2 will no longer be supported after the pydicom v1.4 release'
warnings.warn(msg, DeprecationWarning)
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@

needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
pytest_runner = ['pytest-runner'] if needs_pytest else []

# in_py2 check in next line - pytest>=5 requires Python 3
TESTS_REQUIRE = ['pytest<5'] if sys.version_info[0] == 2 else ['pytest']
_py_modules = []
if not have_dicom:
_py_modules = ['dicom']
Expand Down Expand Up @@ -56,7 +59,6 @@
VERSION = __version__
REQUIRES = []
SETUP_REQUIRES = pytest_runner
TESTS_REQUIRE = ['pytest']

# get long description from README.md
BASE_PATH = os.path.abspath(os.path.dirname(__file__))
Expand Down

0 comments on commit 2c8b11f

Please sign in to comment.