Skip to content

Commit a44d818

Browse files
author
Jonathan Crum
committed
Testing github pytest skip
1 parent f9e2b5d commit a44d818

File tree

4 files changed

+14
-28
lines changed

4 files changed

+14
-28
lines changed

.github/workflows/main.yml

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
name: Tests
2+
23
on: [push]
4+
5+
env:
6+
ENVIRONMENT: Github
7+
38
jobs:
49
build:
510
runs-on: ubuntu-latest

pecs_framework/prefab.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ def deserialize(self, definition: str) -> EntityTemplate:
7272

7373
return entity_template
7474

75-
def register(self, path: str, file: str) -> None:
75+
def register(self, path: str | Path, file: str) -> None:
7676
full_path = str(Path(path, file))
77-
if full_path[-5:] != '.json':
77+
if not full_path.endswith(".json"):
7878
full_path += '.json'
7979

8080
with open(full_path, 'r') as prefab_file:

tests/benchmark.py

-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919

2020
from rich.console import Console
2121

22-
from pycallgraph2 import PyCallGraph
23-
from pycallgraph2.output import GraphvizOutput
24-
2522

2623
@dataclass
2724
class ComponentA(Component):

tests/test_dev.py

+7-23
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import os
99
import pytest
10+
from pathlib import Path
1011

1112
from pecs_framework import Engine
1213
from pecs_framework.base_system import BaseSystem, Loop
@@ -25,8 +26,8 @@
2526
import json
2627

2728

28-
TEST_DIR = os.path.dirname(__file__)
29-
PREFABS = os.path.join(TEST_DIR, 'prefabs')
29+
TEST_DIR = Path(__file__).parent.resolve()
30+
PREFABS = Path(TEST_DIR, 'prefabs')
3031

3132

3233
class MovementSystem(BaseSystem):
@@ -64,9 +65,6 @@ def post_update(self) -> None:
6465
pass
6566

6667

67-
#! TESTS ======================================================================
68-
#! ----------------------------------------------------------------------------
69-
7068
@pytest.fixture(scope="function")
7169
def ecs() -> Engine:
7270
ecs = Engine(loader=loader)
@@ -132,7 +130,6 @@ def prefab() -> str:
132130
return definition
133131

134132

135-
#* PASSING
136133
def test_entity_creation(ecs: Engine, caplog) -> None:
137134
"""
138135
Test that the Entity instances we created exist and are accessible via the
@@ -148,7 +145,7 @@ def test_entity_creation(ecs: Engine, caplog) -> None:
148145
assert all([e1, e2, e3, e4, e5])
149146

150147

151-
# #* PASSING
148+
pytest.mark.skipif(os.environ.get("ENVIRONMENT") == "Github")
152149
def test_component_registration(ecs: Engine) -> None:
153150
"""
154151
Test that specific Component types exist in the ECS Engine and that their
@@ -176,7 +173,6 @@ def test_component_registration(ecs: Engine) -> None:
176173
assert velocity.cbit == 6
177174

178175

179-
#* PASSING
180176
def test_component_attachment(ecs: Engine) -> None:
181177
"""
182178
Test that our Component attachments were successful by checking that the
@@ -199,7 +195,6 @@ def test_component_attachment(ecs: Engine) -> None:
199195
assert utils.owns_component(e1, e1_position)
200196

201197

202-
#* PASSING
203198
def test_component_instantiation(ecs: Engine) -> None:
204199
"""
205200
Test that a Component that is attached to an Entity was instantiated with
@@ -213,7 +208,6 @@ def test_component_instantiation(ecs: Engine) -> None:
213208
assert e1_position.y == 10
214209

215210

216-
#* PASSING
217211
def test_component_removal(ecs: Engine) -> None:
218212
"""
219213
Test that a Component that is attached to an Entity was removed when a
@@ -226,7 +220,6 @@ def test_component_removal(ecs: Engine) -> None:
226220
assert not ecs.components.has(e3, Position)
227221

228222

229-
#* PASSING
230223
def test_entity_destruction(ecs: Engine) -> None:
231224
"""
232225
Test that an Entity that currently exists in the Domain is destroyed when
@@ -251,7 +244,6 @@ def test_entity_destruction(ecs: Engine) -> None:
251244
assert entity3.eid not in domain.entities.keys()
252245

253246

254-
#* PASSING
255247
def test_component_destruction_with_entity(ecs: Engine) -> None:
256248
"""
257249
Test that when an Entity is destroyed, all of its attached Components are
@@ -276,17 +268,16 @@ def test_component_destruction_with_entity(ecs: Engine) -> None:
276268
assert frozen.entity_id == ''
277269

278270

279-
# TODO
271+
pytest.mark.skip(reason="todo")
280272
def test_on_component_added(ecs: Engine) -> None:
281273
pass
282274

283275

284-
# TODO
276+
pytest.mark.skip(reason="todo")
285277
def test_on_component_removed(ecs: Engine) -> None:
286278
pass
287279

288280

289-
#* PASSING
290281
def test_multidomain(ecs: Engine) -> None:
291282
"""
292283
Test the Domain switching feature.
@@ -301,7 +292,6 @@ def test_multidomain(ecs: Engine) -> None:
301292
assert ecs.domain == ecs._domains['World']
302293

303294

304-
#* PASSING
305295
def test_component_query(ecs: Engine) -> None:
306296
"""
307297
Test Component querying. This is crucial to system creation and the heart
@@ -321,7 +311,6 @@ def test_component_query(ecs: Engine) -> None:
321311
assert len(movable.result) == 1
322312

323313

324-
#* PASSING
325314
def test_system_behavior(ecs: Engine) -> None:
326315
"""
327316
Test that a system using a Query can modify the state of Component
@@ -371,18 +360,15 @@ def test_entity_events(ecs: Engine) -> None:
371360
assert e2[Health].current == e2[Health].maximum - 15
372361

373362

374-
#* PASSING
375363
def test_component_loader(ecs: Engine) -> None:
376364
assert len(ecs.components._map) == 7
377365

378366

379-
# TODO
367+
pytest.mark.skip(reason="todo")
380368
def test_serialization(ecs: Engine) -> None:
381-
# ecs.serialize()
382369
pass
383370

384371

385-
#* PASSING
386372
def test_deserialization(ecs: Engine, prefab: str) -> None:
387373
"""Test prefab definition unpacking into the correct objects."""
388374
template: EntityTemplate = ecs.prefabs.deserialize(prefab)
@@ -392,7 +378,6 @@ def test_deserialization(ecs: Engine, prefab: str) -> None:
392378
assert len(template.components) == 3
393379

394380

395-
#* PASSING
396381
def test_prefab(ecs: Engine, prefab: str) -> None:
397382
template: EntityTemplate = ecs.prefabs.deserialize(prefab)
398383
components: list[ComponentTemplate] = template.components
@@ -401,7 +386,6 @@ def test_prefab(ecs: Engine, prefab: str) -> None:
401386
assert components[1].properties['ch'] == '?'
402387

403388

404-
#* PASSING
405389
def test_entity_from_prefab(ecs: Engine) -> None:
406390
test_entity = ecs.domain.entities.create_from_prefab(
407391
template = 'Character',

0 commit comments

Comments
 (0)