mirror of
https://github.com/OMGeeky/pytiled_parser.git
synced 2026-01-24 19:21:48 +01:00
More CI test fixes
This commit is contained in:
38
.github/workflows/lint.yml
vendored
38
.github/workflows/lint.yml
vendored
@@ -1,38 +0,0 @@
|
|||||||
name: Lint
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [development]
|
|
||||||
pull_request:
|
|
||||||
branches: [development]
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
|
|
||||||
build:
|
|
||||||
name: Lint
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@master
|
|
||||||
- name: Set up Python 3.x
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: '3.x'
|
|
||||||
architecture: 'x64'
|
|
||||||
- name: dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install -U pip wheel setuptools
|
|
||||||
- name: wheel
|
|
||||||
run: |
|
|
||||||
python -m pip install -e .[tests]
|
|
||||||
- name: flake8
|
|
||||||
run: |
|
|
||||||
flake8 pytiled_parser
|
|
||||||
- name: mypy
|
|
||||||
run: |
|
|
||||||
mypy pytiled_parser
|
|
||||||
- name: black
|
|
||||||
run: |
|
|
||||||
black pytiled_parser --check
|
|
||||||
|
|
||||||
19
.github/workflows/test.yml
vendored
19
.github/workflows/test.yml
vendored
@@ -25,14 +25,25 @@ jobs:
|
|||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
architecture: ${{ matrix.architecture }}
|
architecture: ${{ matrix-python-version }}
|
||||||
- name: dependencies
|
- name: dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install -U pip wheel setuptools
|
python -m pip install -U pip wheel setuptools
|
||||||
- name: wheel
|
- name: wheel
|
||||||
run: |
|
run: |
|
||||||
python -m pip install -e .[tests]
|
python -m pip install -e .[tests]
|
||||||
- name: pytest
|
- name: flake8
|
||||||
run: |
|
run: |
|
||||||
pytest --cov=pytiled_parser --cov-report=xml --cov-report=html
|
flake8 pytiled_parser
|
||||||
|
- name: mypy
|
||||||
|
if: success() || failure()
|
||||||
|
run: |
|
||||||
|
mypy pytiled_parser
|
||||||
|
- name: black
|
||||||
|
if: success() || failure()
|
||||||
|
run: |
|
||||||
|
black pytiled_parser --check
|
||||||
|
- name: pytest
|
||||||
|
if: success() || failure()
|
||||||
|
run: |
|
||||||
|
pytest --cov=pytiled_parser --cov-report=xml --cov-report=html
|
||||||
@@ -14,14 +14,14 @@ EXPECTED = world.World(
|
|||||||
),
|
),
|
||||||
world.WorldMap(
|
world.WorldMap(
|
||||||
size=common_types.Size(160, 160),
|
size=common_types.Size(160, 160),
|
||||||
coordinates=common_types.OrderedPair(0, 0),
|
coordinates=common_types.OrderedPair(0.0, 0.0),
|
||||||
map_file=Path(Path(__file__).parent / "map_p0-n0.json")
|
map_file=Path(Path(__file__).parent / "map_p0-n0.json")
|
||||||
.absolute()
|
.absolute()
|
||||||
.resolve(),
|
.resolve(),
|
||||||
),
|
),
|
||||||
world.WorldMap(
|
world.WorldMap(
|
||||||
size=common_types.Size(160, 160),
|
size=common_types.Size(160, 160),
|
||||||
coordinates=common_types.OrderedPair(0, 160),
|
coordinates=common_types.OrderedPair(0.0, 160.0),
|
||||||
map_file=Path(Path(__file__).parent / "map_p0-n1.json")
|
map_file=Path(Path(__file__).parent / "map_p0-n1.json")
|
||||||
.absolute()
|
.absolute()
|
||||||
.resolve(),
|
.resolve(),
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from pytiled_parser import common_types, layer, tiled_map, tileset, world
|
from pytiled_parser import common_types, world
|
||||||
|
|
||||||
EXPECTED = world.World(
|
EXPECTED = world.World(
|
||||||
only_show_adjacent=False,
|
only_show_adjacent=False,
|
||||||
maps=[
|
maps=[
|
||||||
world.WorldMap(
|
world.WorldMap(
|
||||||
size=common_types.Size(160, 160),
|
size=common_types.Size(160, 160),
|
||||||
coordinates=common_types.OrderedPair(0, 0),
|
coordinates=common_types.OrderedPair(0.0, 0.0),
|
||||||
map_file=Path(Path(__file__).parent / "map_p0-n0.json")
|
map_file=Path(Path(__file__).parent / "map_p0-n0.json")
|
||||||
.absolute()
|
.absolute()
|
||||||
.resolve(),
|
.resolve(),
|
||||||
),
|
),
|
||||||
world.WorldMap(
|
world.WorldMap(
|
||||||
size=common_types.Size(160, 160),
|
size=common_types.Size(160, 160),
|
||||||
coordinates=common_types.OrderedPair(0, 160),
|
coordinates=common_types.OrderedPair(0.0, 160.0),
|
||||||
map_file=Path(Path(__file__).parent / "map_p0-n1.json")
|
map_file=Path(Path(__file__).parent / "map_p0-n1.json")
|
||||||
.absolute()
|
.absolute()
|
||||||
.resolve(),
|
.resolve(),
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from pytiled_parser import OrderedPair, world
|
from pytiled_parser import world
|
||||||
|
|
||||||
TESTS_DIR = Path(os.path.dirname(os.path.abspath(__file__)))
|
TESTS_DIR = Path(os.path.dirname(os.path.abspath(__file__)))
|
||||||
TEST_DATA = TESTS_DIR / "test_data"
|
TEST_DATA = TESTS_DIR / "test_data"
|
||||||
@@ -18,16 +18,6 @@ ALL_WORLD_TESTS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def fix_world_map(world_map):
|
|
||||||
world_map.coordinates = OrderedPair(
|
|
||||||
round(world_map.coordinates[0], 3), round(world_map.coordinates[1], 3)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def fix_world(world):
|
|
||||||
for world_map in world.maps:
|
|
||||||
fix_world_map(world_map)
|
|
||||||
|
|
||||||
@pytest.mark.parametrize("world_test", ALL_WORLD_TESTS)
|
@pytest.mark.parametrize("world_test", ALL_WORLD_TESTS)
|
||||||
def test_world_integration(world_test):
|
def test_world_integration(world_test):
|
||||||
# it's a PITA to import like this, don't do it
|
# it's a PITA to import like this, don't do it
|
||||||
@@ -41,6 +31,5 @@ def test_world_integration(world_test):
|
|||||||
raw_world_path = world_test / "world.world"
|
raw_world_path = world_test / "world.world"
|
||||||
|
|
||||||
casted_world = world.parse_world(raw_world_path)
|
casted_world = world.parse_world(raw_world_path)
|
||||||
fix_world(casted_world)
|
|
||||||
|
|
||||||
assert casted_world == expected.EXPECTED
|
assert casted_world == expected.EXPECTED
|
||||||
|
|||||||
Reference in New Issue
Block a user