Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove test from setup.py, unify test requirements #565

Merged
merged 3 commits into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion ruff.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[lint]
extend-select = [
"E",
"F",
Expand All @@ -10,13 +11,14 @@ extend-select = [
]

ignore = [
"E721", # TODO: do not ignore?
glepretre marked this conversation as resolved.
Show resolved Hide resolved
"E731",
"E741",
"PLW2901", # TODO: do not ignore?
"PLW3301", # TODO: do not ignore?
]

[per-file-ignores]
[lint.per-file-ignores]
"pygal/__init__.py" = [
"E402",
"F401",
Expand Down
40 changes: 16 additions & 24 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,26 @@
# You should have received a copy of the GNU Lesser General Public License
# along with pygal. If not, see <http://www.gnu.org/licenses/>.
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)
glepretre marked this conversation as resolved.
Show resolved Hide resolved


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>=0.5.6",
]

moulinrouge_requirements = [
"flask",
"pygal_maps_ch",
"pygal_maps_fr",
"pygal_maps_world",
]

about = {}
Expand All @@ -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",
Expand Down
8 changes: 1 addition & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Loading