Skip to content

Commit

Permalink
Merge pull request #565 from akx/setup-py-test
Browse files Browse the repository at this point in the history
Remove test from setup.py, unify test requirements
  • Loading branch information
glepretre authored Aug 12, 2024
2 parents 49137c3 + 70fa885 commit 4c42c17
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 33 deletions.
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?
"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)


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

0 comments on commit 4c42c17

Please sign in to comment.