Skip to content

Commit dcfa72d

Browse files
committed
setup: disable test command
1 parent 765f969 commit dcfa72d

File tree

1 file changed

+24
-16
lines changed

1 file changed

+24
-16
lines changed

setup.py

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,41 @@
33
import sys
44
from os import environ, path
55
from sys import argv, path as sys_path
6+
from textwrap import dedent
67

78
from setuptools import find_packages, setup
89

910
import versioneer
1011

1112

13+
def format_msg(text, *args, **kwargs):
14+
return dedent(text).strip(" \n").format(*args, **kwargs)
15+
16+
1217
CURRENT_PYTHON = sys.version_info[:2]
1318
REQUIRED_PYTHON = (3, 6)
1419

1520
# This check and everything above must remain compatible with older Python versions
1621
if CURRENT_PYTHON < REQUIRED_PYTHON:
17-
# noinspection PyStringFormat
18-
sys.exit(
19-
"""
20-
========================================================
21-
Unsupported Python version
22-
========================================================
23-
This version of Streamlink requires at least Python {}.{},
24-
but you're trying to install it on Python {}.{}.
25-
26-
This may be because you are using a version of pip that
27-
doesn't understand the python_requires classifier.
28-
Make sure you have pip >= 9.0 and setuptools >= 24.2
29-
"""
30-
.strip(" \n")
31-
.format(*(REQUIRED_PYTHON + CURRENT_PYTHON))
32-
)
22+
sys.exit(format_msg("""
23+
========================================================
24+
Unsupported Python version
25+
========================================================
26+
This version of Streamlink requires at least Python {}.{},
27+
but you're trying to install it on Python {}.{}.
28+
29+
This may be because you are using a version of pip that
30+
doesn't understand the python_requires classifier.
31+
Make sure you have pip >= 9.0 and setuptools >= 24.2
32+
""", *(REQUIRED_PYTHON + CURRENT_PYTHON)))
33+
34+
# Explicitly disable running tests via setuptools
35+
if "test" in sys.argv:
36+
sys.exit(format_msg("""
37+
Running `python setup.py test` has been deprecated since setuptools 41.5.0.
38+
Streamlink requires pytest for collecting and running tests, via one of these commands:
39+
`pytest` or `python -m pytest` (see the pytest docs for more infos about this)
40+
"""))
3341

3442

3543
data_files = []

0 commit comments

Comments
 (0)