Skip to content

Commit

Permalink
installation: deprecate tests_require and fix tox configuration
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
tiborsimko committed Aug 22, 2024
1 parent ea24900 commit c9c0e74
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 33 deletions.
4 changes: 2 additions & 2 deletions run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# This file is part of cernopendata-client.
#
# Copyright (C) 2019, 2020, 2021, 2023 CERN.
# Copyright (C) 2019, 2020, 2021, 2023, 2024 CERN.
#
# cernopendata-client is free software; you can redistribute it and/or modify
# it under the terms of the GPLv3 license; see LICENSE file for more details.
Expand Down Expand Up @@ -51,7 +51,7 @@ check_sphinx () {
}

check_pytest () {
python setup.py test
pytest
}

if [ $# -eq 0 ]; then
Expand Down
5 changes: 1 addition & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@
#
# This file is part of cernopendata-client.
#
# Copyright (C) 2020 CERN.
# Copyright (C) 2020, 2024 CERN.
#
# cernopendata-client is free software; you can redistribute it and/or modify
# it under the terms of the GPLv3 license; see LICENSE file for more details.

[aliases]
test = pytest

[build_sphinx]
source-dir = docs/
build-dir = docs/_build
Expand Down
35 changes: 14 additions & 21 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# This file is part of cernopendata-client.
#
# Copyright (C) 2019, 2020, 2021, 2022, 2023 CERN.
# Copyright (C) 2019, 2020, 2021, 2022, 2023, 2024 CERN.
#
# cernopendata-client is free software; you can redistribute it and/or modify
# it under the terms of the GPLv3 license; see LICENSE file for more details.
Expand All @@ -16,19 +16,6 @@
readme = open("README.rst").read()
history = open("CHANGES.rst").read()

tests_require = [
'black>=19.10b0 ; python_version>="3"',
"check-manifest>=0.25",
"coverage>=4.0",
"mock>=3.0",
"pydocstyle>=1.0.0",
"pytest-cache>=1.0",
"pytest-cov>=1.8.0",
"pytest>=2.8.0",
'platformdirs<2.1 ; python_version=="3.6"',
'pytest-mock>=2.0,<3.0 ; python_version=="2.7"',
'pytest-mock>=3.0 ; python_version>="3"',
]

extras_require = {
"docs": [
Expand All @@ -38,7 +25,19 @@
"sphinx-click>=2.5.0",
],
"pycurl": ["pycurl>=7"],
"tests": tests_require,
"tests": [
'black>=19.10b0 ; python_version>="3"',
"check-manifest>=0.25",
"coverage>=4.0",
"mock>=3.0",
"pydocstyle>=1.0.0",
"pytest-cache>=1.0",
"pytest-cov>=1.8.0",
"pytest>=2.8.0",
'platformdirs<2.1 ; python_version=="3.6"',
'pytest-mock>=2.0,<3.0 ; python_version=="2.7"',
'pytest-mock>=3.0 ; python_version>="3"',
],
"xrootd": [
"xrootd>=4.12.2",
],
Expand All @@ -50,10 +49,6 @@
continue
extras_require["all"].extend(reqs)

setup_requires = [
"pytest-runner>=2.7",
]

install_requires = ["click>=7", "requests>=2"]

# Get the version string. Cannot be done with import!
Expand All @@ -74,8 +69,6 @@
],
extras_require=extras_require,
install_requires=install_requires,
setup_requires=setup_requires,
tests_require=tests_require,
entry_points={
"console_scripts": [
"cernopendata-client = cernopendata_client.cli:cernopendata_client"
Expand Down
24 changes: 18 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
# This file is part of cernopendata-client.
#
# Copyright (C) 2020, 2022, 2023 CERN.
# Copyright (C) 2020, 2022, 2023, 2024 CERN.
#
# cernopendata-client is free software; you can redistribute it and/or modify
# it under the terms of the GPLv3 license; see LICENSE file for more details.

[tox]
envlist = py36, py37, py38, py39, py310, py311, py312
envlist =
py36
py37
py38
py39
py310
py311
py312

[testenv]
deps = pytest
pytest-cov
setuptools
commands = {envpython} setup.py test
deps =
pytest
pytest-cov
pytest-mock
setuptools
commands =
pytest {posargs}
package =
editable-legacy

0 comments on commit c9c0e74

Please sign in to comment.