Skip to content

Commit 6c4fde4

Browse files
jdufresnefcurella
authored andcommitted
Replace deprecated 'setup.py test' with tox/pytest (#1094)
* Unpin coverage * Replace deprecated 'setup.py test' with tox/pytest Since setuptools v41.5.0 (27 Oct 2019), the 'test' command is formally deprecated and should not be used. Now, run the pytest command from tox as recommended by setuptools.
1 parent 01c543a commit 6c4fde4

File tree

6 files changed

+16
-23
lines changed

6 files changed

+16
-23
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
test:
2-
coverage run --source=faker --omit=faker/build_docs.py setup.py test
2+
tox -e py
33

44
isort:
55
isort -rc --atomic .

appveyor.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,5 @@ test_script:
5252
- "%PYTHON%/Scripts/pip.exe --version"
5353
- "%PYTHON%/Scripts/pip.exe freeze"
5454
- "%PYTHON%/python.exe --version"
55-
- "%PYTHON%/Scripts/pip.exe install -U setuptools"
56-
- "%PYTHON%/Scripts/pip.exe install \"importlib-metadata>=0.12\""
57-
- "%PYTHON%/python.exe setup.py test"
55+
- "%PYTHON%/Scripts/pip.exe install tox"
56+
- "%PYTHON%/python.exe -m tox -e py"

build32bit.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ docker run -v ${PWD}:/code -e INSTALL_REQUIREMENTS=${INSTALL_REQUIREMENTS} i386/
1212
&& locale-gen en_US.UTF-8 \
1313
&& export LANG='en_US.UTF-8' \
1414
&& cd /code \
15-
&& coverage run --source=faker setup.py test \
15+
&& tox -e py \
1616
&& coverage report"

setup.cfg

-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ universal = 1
44
[pep8]
55
max-line-length = 80
66

7-
[aliases]
8-
test=pytest
9-
107
[tool:pytest]
118
addopts = --verbose
129
python_files = tests/*.py

setup.py

-13
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,13 @@
5959
license='MIT License',
6060
packages=find_packages(exclude=["docs", "tests", "tests.*"]),
6161
platforms=["any"],
62-
test_suite='tests',
6362
zip_safe=zip_safe,
6463
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
65-
setup_requires=["pytest-runner"],
6664
install_requires=[
6765
"python-dateutil>=2.4",
6866
"six>=1.10",
6967
"text-unidecode==1.3",
7068
],
71-
tests_require=[
72-
"validators>=0.13.0",
73-
"ukpostcodeparser>=1.1.1",
74-
"mock ; python_version < '3.3'",
75-
"pytest>=3.8.0,<3.9",
76-
"more-itertools<6.0.0 ; python_version < '3.0'",
77-
# restricted because they may drop python2 support in future versions
78-
# https://github.com/joke2k/faker/issues/970
79-
"random2<1.1",
80-
"freezegun<0.4",
81-
],
8269
extras_require={
8370
':python_version<"3.3"': [
8471
'ipaddress',

tox.ini

+12-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,19 @@ envlist=py{27,35,36,37,38,py,py3},32bit,flake8,checkmanifest,isort
33
skip_missing_interpreters = true
44

55
[testenv]
6-
deps = coverage==4.5.4
6+
deps =
7+
coverage
8+
freezegun<0.4
9+
mock; python_version<"3.3"
10+
more-itertools<6.0.0; python_version<"3.0"
11+
pytest>=3.8.0,<3.9
12+
# restricted because they may drop python2 support in future versions
13+
# https://github.com/joke2k/faker/issues/970
14+
random2<1.1
15+
ukpostcodeparser>=1.1.1
16+
validators>=0.13.0
717
commands =
8-
coverage run --source=faker setup.py test
18+
coverage run --source=faker -m pytest
919
coverage report
1020

1121
[testenv:flake8]

0 commit comments

Comments
 (0)