Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCheese42 committed Jun 1, 2024
2 parents 8cd2ee5 + ea8d47e commit 9d895be
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ If the level is left out, it will be `logging.DEBUG` or `logging.WARNING`, depen

## Testing

Testing has to be done locally as the GitHub remote is running headless. Now with the transition to arcade 3 excluding the `requires_window` mark doesn't work either anymore.
Despite having an action for testing, GitHub Actions is running headless so some functions (with the `requires_window` mark) won't run there, requiring local testing before every merge as well.
10 changes: 5 additions & 5 deletions cme/resource_/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ class AssetsPath(type(Path())): # type: ignore
Subclass or instantiate this to create a hierarchie of assets folders
(e.g. `ImagesPath`, `SoundsPath`, ...).
"""

def __new__(cls, *pathsegments: str | Path) -> AssetsPath:
return super().__new__(cls, *pathsegments) # type: ignore
obj: AssetsPath = super().__new__(cls, *pathsegments)
obj.get = obj.find_asset
return obj

def __init__(self, *args: Any) -> None:
super().__init__(*args)
self.get = self.find_asset
# Avoiding using an __init__ because it doesn't work really well with the
# pathlib Path system

def find_asset(
self,
Expand Down
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from cme import init_cme # noqa


@pytest.mark.requires_window
@pytest.fixture(scope="session")
def initialize_window() -> Generator[arcade.Window, None, None]:
window = arcade.Window()
Expand Down
8 changes: 6 additions & 2 deletions tests/test_logger/test_logger.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import atexit
import logging
import os
import shutil
from pathlib import Path
from tempfile import mkdtemp

Expand All @@ -25,4 +25,8 @@ def test_logger_functions() -> None:
logger.error("Error")
logger.critical("Critical")

atexit.register(lambda: os.unlink(tempdir))
def cleanup_logger() -> None:
logging.shutdown()
shutil.rmtree(tempdir)

atexit.register(cleanup_logger)
4 changes: 2 additions & 2 deletions tests/test_utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ def test_get_optimal_font_size(initialize_window: None) -> None:
input_args = [
("Hello World!", "Times New Roman", 64, 96),
("This is part of our amazing test suite", "Calibri", 12345, 67890),
("Sage, the life you give... Have you ever wondered where it's taken from?", "Comic Sans MS", 1000, 200), # noqa
("Sage, the life you give... Have you ever wondered where it's taken from?", "Arial", 1000, 200), # noqa
]
expected_output = [
9,
512,
29,
23,
]
for (
(text, font_name, container_width, container_height), expected
Expand Down

0 comments on commit 9d895be

Please sign in to comment.