Skip to content

Commit c9c0e74

Browse files
committed
installation: deprecate tests_require and fix tox configuration
Amends installation setup with respect to deprecated `tests_require` and `pytest-runner`. Amends `tox` testing setup to fix mocker fixture import issue. Improves `tox` testing setup to produce correct coverage findings by forcing "editable" package installation mode. (In its "editable-legacy" variant which is necessary for Python-3.6 that we are still supporting in the client.)
1 parent ea24900 commit c9c0e74

File tree

4 files changed

+35
-33
lines changed

4 files changed

+35
-33
lines changed

run-tests.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# This file is part of cernopendata-client.
44
#
5-
# Copyright (C) 2019, 2020, 2021, 2023 CERN.
5+
# Copyright (C) 2019, 2020, 2021, 2023, 2024 CERN.
66
#
77
# cernopendata-client is free software; you can redistribute it and/or modify
88
# it under the terms of the GPLv3 license; see LICENSE file for more details.
@@ -51,7 +51,7 @@ check_sphinx () {
5151
}
5252

5353
check_pytest () {
54-
python setup.py test
54+
pytest
5555
}
5656

5757
if [ $# -eq 0 ]; then

setup.cfg

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22
#
33
# This file is part of cernopendata-client.
44
#
5-
# Copyright (C) 2020 CERN.
5+
# Copyright (C) 2020, 2024 CERN.
66
#
77
# cernopendata-client is free software; you can redistribute it and/or modify
88
# it under the terms of the GPLv3 license; see LICENSE file for more details.
99

10-
[aliases]
11-
test = pytest
12-
1310
[build_sphinx]
1411
source-dir = docs/
1512
build-dir = docs/_build

setup.py

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# This file is part of cernopendata-client.
44
#
5-
# Copyright (C) 2019, 2020, 2021, 2022, 2023 CERN.
5+
# Copyright (C) 2019, 2020, 2021, 2022, 2023, 2024 CERN.
66
#
77
# cernopendata-client is free software; you can redistribute it and/or modify
88
# it under the terms of the GPLv3 license; see LICENSE file for more details.
@@ -16,19 +16,6 @@
1616
readme = open("README.rst").read()
1717
history = open("CHANGES.rst").read()
1818

19-
tests_require = [
20-
'black>=19.10b0 ; python_version>="3"',
21-
"check-manifest>=0.25",
22-
"coverage>=4.0",
23-
"mock>=3.0",
24-
"pydocstyle>=1.0.0",
25-
"pytest-cache>=1.0",
26-
"pytest-cov>=1.8.0",
27-
"pytest>=2.8.0",
28-
'platformdirs<2.1 ; python_version=="3.6"',
29-
'pytest-mock>=2.0,<3.0 ; python_version=="2.7"',
30-
'pytest-mock>=3.0 ; python_version>="3"',
31-
]
3219

3320
extras_require = {
3421
"docs": [
@@ -38,7 +25,19 @@
3825
"sphinx-click>=2.5.0",
3926
],
4027
"pycurl": ["pycurl>=7"],
41-
"tests": tests_require,
28+
"tests": [
29+
'black>=19.10b0 ; python_version>="3"',
30+
"check-manifest>=0.25",
31+
"coverage>=4.0",
32+
"mock>=3.0",
33+
"pydocstyle>=1.0.0",
34+
"pytest-cache>=1.0",
35+
"pytest-cov>=1.8.0",
36+
"pytest>=2.8.0",
37+
'platformdirs<2.1 ; python_version=="3.6"',
38+
'pytest-mock>=2.0,<3.0 ; python_version=="2.7"',
39+
'pytest-mock>=3.0 ; python_version>="3"',
40+
],
4241
"xrootd": [
4342
"xrootd>=4.12.2",
4443
],
@@ -50,10 +49,6 @@
5049
continue
5150
extras_require["all"].extend(reqs)
5251

53-
setup_requires = [
54-
"pytest-runner>=2.7",
55-
]
56-
5752
install_requires = ["click>=7", "requests>=2"]
5853

5954
# Get the version string. Cannot be done with import!
@@ -74,8 +69,6 @@
7469
],
7570
extras_require=extras_require,
7671
install_requires=install_requires,
77-
setup_requires=setup_requires,
78-
tests_require=tests_require,
7972
entry_points={
8073
"console_scripts": [
8174
"cernopendata-client = cernopendata_client.cli:cernopendata_client"

tox.ini

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
11
# This file is part of cernopendata-client.
22
#
3-
# Copyright (C) 2020, 2022, 2023 CERN.
3+
# Copyright (C) 2020, 2022, 2023, 2024 CERN.
44
#
55
# cernopendata-client is free software; you can redistribute it and/or modify
66
# it under the terms of the GPLv3 license; see LICENSE file for more details.
77

88
[tox]
9-
envlist = py36, py37, py38, py39, py310, py311, py312
9+
envlist =
10+
py36
11+
py37
12+
py38
13+
py39
14+
py310
15+
py311
16+
py312
1017

1118
[testenv]
12-
deps = pytest
13-
pytest-cov
14-
setuptools
15-
commands = {envpython} setup.py test
19+
deps =
20+
pytest
21+
pytest-cov
22+
pytest-mock
23+
setuptools
24+
commands =
25+
pytest {posargs}
26+
package =
27+
editable-legacy

0 commit comments

Comments
 (0)