From 5d8b32c91b7625dc643f60c1b18a7a94a0eff1ef Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Mon, 29 Jul 2024 11:38:56 +0300 Subject: [PATCH 1/3] Remove test from setup.py, unify test requirements --- setup.py | 40 ++++++++++++++++------------------------ tox.ini | 8 +------- 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/setup.py b/setup.py index d67226c8..448efdc2 100644 --- a/setup.py +++ b/setup.py @@ -18,34 +18,26 @@ # You should have received a copy of the GNU Lesser General Public License # along with pygal. If not, see . import os -import sys from setuptools import find_packages, setup -from setuptools.command.test import test as TestCommand - - -class PyTest(TestCommand): - def finalize_options(self): - TestCommand.finalize_options(self) - self.test_args = ['-x', 'build/lib/pygal'] - self.test_suite = True - - def run_tests(self): - # import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(self.test_args) - sys.exit(errno) - ROOT = os.path.dirname(__file__) - tests_requirements = [ - "pyquery", "flask", 'cairosvg', 'lxml', 'pygal_maps_world', 'pygal_maps_fr', - 'pygal_maps_ch', 'coveralls', - 'ruff', - 'pytest-runner', 'pytest-cov', - 'pytest' + "cairosvg", + "coveralls", + "lxml", + "pyquery", + "pytest", + "pytest-cov", + "ruff", +] + +moulinrouge_requirements = [ + "flask", + "pygal_maps_ch", + "pygal_maps_fr", + "pygal_maps_world", ] about = {} @@ -72,13 +64,13 @@ def run_tests(self): "svg", "chart", "graph", "diagram", "plot", "histogram", "kiviat"], setup_requires=['pytest-runner'], install_requires=['importlib-metadata'], # TODO: remove this (see #545, #546) - cmdclass={'test': PyTest}, package_data={'pygal': ['css/*', 'graph/maps/*.svg']}, extras_require={ 'lxml': ['lxml'], 'docs': ['sphinx', 'sphinx_rtd_theme', 'pygal_sphinx_directives'], 'png': ['cairosvg'], - 'test': tests_requirements + 'test': tests_requirements, + 'moulinrouge': moulinrouge_requirements, }, classifiers=[ "Development Status :: 4 - Beta", diff --git a/tox.ini b/tox.ini index 6c7d4767..7a3b8882 100644 --- a/tox.ini +++ b/tox.ini @@ -2,13 +2,7 @@ envlist = py38,py39,py310,py311,py312,pypy [testenv] -deps = - pytest - coverage - lxml - pyquery - cairosvg - +extras = test setenv = COVERAGE_FILE=.cov-{envname} commands = From fd869225d10de2f86c9320817fc5cb8959c23473 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Mon, 29 Jul 2024 11:45:41 +0300 Subject: [PATCH 2/3] Use `ruff check`, pin `ruff` requirement to a version that has `ruff check` --- Makefile | 2 +- ruff.toml | 4 +++- setup.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index a170ae3e..ad8e1ca9 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ clean: rm -fr *.egg-info lint: - $(RUFF) $(PROJECT_NAME) + $(RUFF) check $(PROJECT_NAME) check: $(PYTEST) $(PROJECT_NAME) $(PYTEST_ARGS) --cov-report= --cov=pygal diff --git a/ruff.toml b/ruff.toml index bff58147..798a6485 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,3 +1,4 @@ +[lint] extend-select = [ "E", "F", @@ -10,13 +11,14 @@ extend-select = [ ] ignore = [ + "E721", # TODO: do not ignore? "E731", "E741", "PLW2901", # TODO: do not ignore? "PLW3301", # TODO: do not ignore? ] -[per-file-ignores] +[lint.per-file-ignores] "pygal/__init__.py" = [ "E402", "F401", diff --git a/setup.py b/setup.py index 448efdc2..1a83b20e 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ "pyquery", "pytest", "pytest-cov", - "ruff", + "ruff>=0.5.5", ] moulinrouge_requirements = [ From 70fa885560b4d106cb58578737da6de27a3c7fa6 Mon Sep 17 00:00:00 2001 From: Aarni Koskela Date: Tue, 6 Aug 2024 12:31:35 +0300 Subject: [PATCH 3/3] Bump ruff to 0.5.6 Co-authored-by: Christian Clauss --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1a83b20e..ce859e74 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ "pyquery", "pytest", "pytest-cov", - "ruff>=0.5.5", + "ruff>=0.5.6", ] moulinrouge_requirements = [