Skip to content

Commit

Permalink
#1053: setup.py does not include tests files on py2.6; __init__.py wi…
Browse files Browse the repository at this point in the history
…ll raise a deprecation warning on import
  • Loading branch information
giampaolo committed May 6, 2017
1 parent 93a989f commit bdd5331
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
7 changes: 7 additions & 0 deletions psutil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import sys
import time
import traceback
import warnings
try:
import pwd
except ImportError:
Expand Down Expand Up @@ -223,6 +224,12 @@
raise ImportError(msg)


if sys.version_info[:2] == (2, 6):
warnings.warn(
"Python 2.6 support is deprecated and unit tests won't run",
DeprecationWarning)


# =====================================================================
# --- exceptions
# =====================================================================
Expand Down
4 changes: 1 addition & 3 deletions psutil/tests/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
PYTHON = os.path.basename(sys.executable)
GET_PIP_URL = "https://bootstrap.pypa.io/get-pip.py"
TEST_DEPS = []
if sys.version_info[:2] == (2, 6):
TEST_DEPS.extend(["ipaddress", "unittest2", "argparse", "mock==1.0.1"])
elif sys.version_info[:2] == (2, 7) or sys.version_info[:2] <= (3, 2):
if sys.version_info[:2] == (2, 7) or sys.version_info[:2] <= (3, 2):
TEST_DEPS.extend(["ipaddress", "mock"])
elif sys.version_info[:2] == (3, 3):
TEST_DEPS.extend(["ipaddress"])
Expand Down
10 changes: 9 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@
if POSIX:
sources.append('psutil/_psutil_posix.c')

packages = ['psutil']
if sys.version_info[:2] != (2, 6):
packages.append('psutil.tests')
else:
warnings.warn(
"Python 2.6 support is deprecated and unit tests won't run",
DeprecationWarning)


def get_version():
INIT = os.path.join(HERE, 'psutil/__init__.py')
Expand Down Expand Up @@ -259,7 +267,7 @@ def main():
url='https://github.com/giampaolo/psutil',
platforms='Platform Independent',
license='BSD',
packages=['psutil', 'psutil.tests'],
packages=packages,
ext_modules=extensions,
test_suite="psutil.tests.get_suite",
tests_require=['ipaddress', 'mock', 'unittest2'],
Expand Down

0 comments on commit bdd5331

Please sign in to comment.