diff --git a/.github/workflows/python-testing.yml b/.github/workflows/python-testing.yml new file mode 100644 index 0000000..7d58025 --- /dev/null +++ b/.github/workflows/python-testing.yml @@ -0,0 +1,37 @@ +name: Python tests + +on: + push: + branches: ["main"] + pull_request: + branches: ["main"] + +jobs: + build: + runs-on: macos-14 + strategy: + fail-fast: false + matrix: + python-version: ["3.10", "3.11", "3.12"] + + steps: + - uses: actions/checkout@v4 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install poetry + run: pipx install poetry + - name: Install dependencies + run: | + brew install cairo + poetry env use python${{ matrix.python-version }} + poetry install + - name: Lint with flake8 + run: | + poetry run flake8 + - name: Lint with black + run: poetry run black --check . + - name: Test with pytest + run: | + poetry run pytest diff --git a/README.md b/README.md index bb42cb9..321a80a 100644 --- a/README.md +++ b/README.md @@ -209,6 +209,9 @@ The project includes unit tests to ensure the functionality of various component pytest ``` +Note that if you have a different cairo version installed some tests might fail. This is due to the fact that the tests compare the rendered images with reference images. If you have a different cairo version installed, the images might look slightly different. + + ## Output Example The image below is an example of a map created using the Mapsy library: diff --git a/mapsy/icon/icon.py b/mapsy/icon/icon.py index 285374e..4bd26c7 100644 --- a/mapsy/icon/icon.py +++ b/mapsy/icon/icon.py @@ -1,5 +1,4 @@ from dataclasses import dataclass -import os from pathlib import Path from mapsy.common import IconAlign diff --git a/test/util.py b/test/util.py index 6f4cba6..298e9ab 100644 --- a/test/util.py +++ b/test/util.py @@ -1,4 +1,3 @@ -import pytest import mapsy from contextlib import contextmanager from os import path