Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: CI

on:
push:
branches: [ dev ]
pull_request:
branches: [ dev ]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.14"

- name: Install dependencies
run: pip install -r requirements.txt

- name: Run tests
run: pytest

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.14"

- name: Install dependencies
run: pip install -r requirements.txt

- name: Run pylint
run: pylint src --rcfile=.pylintrc --fail-under=9.5
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.idea
/generation
src/utils/generation/
__pycache__/
.python-version
4 changes: 0 additions & 4 deletions .pylintrc
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,6 @@ recursive=no
# source root.
source-roots=

# When enabled, pylint would attempt to guess common misconfiguration and emit
# user-friendly hints instead of false-positive error messages.
suggestion-mode=yes

# Allow loading of arbitrary C extensions. Extensions are imported into the
# active Python interpreter and may run arbitrary code.
unsafe-load-any-extension=no
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[tool.pytest.ini_options]
pythonpath = ["src"]
testpaths = ["test"]
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ black~=26.5.1
pylint~=4.0.2
flake8~=7.3.0
mypy~=2.3.0
pillow~=12.3.0
pillow~=12.3.0
pytest~=9.1.1
5 changes: 2 additions & 3 deletions src/utils/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ class Color(Enum):
# Json
BASE_INDENT = " "
JSON_SUFFIX = ".json"
APPLICATION_PATH = os.path.realpath(
os.path.dirname(__file__).replace("\\src", "").replace("\\utils", "")
)
_CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
APPLICATION_PATH = os.path.dirname(os.path.dirname(_CURRENT_DIR))
DEFAULT_FLOOR_NAME = "floor"
DEFAULT_FLOOR_DIRECTORY = "generation"

Expand Down
2 changes: 1 addition & 1 deletion test/floor_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def setUp(self) -> None:
self._floor_with_rooms.add_room(5, 5)

def test_to_json(self):
expected = '{\n "_rooms": []\n}'
expected = '{\n "_seed": "1",\n "_rooms": []\n}'
self.assertEqual(expected, self._floor.to_json(1))

def test_contains_room(self):
Expand Down
17 changes: 8 additions & 9 deletions test/globals_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def test_door_faces(self):
self.assertEqual(expected, globals.DoorFace.list())

def test_room_types(self):
expected = [0, 1, 2, 3, 4, 5, 6]
expected = [0, 1, 2, 3, 4, 5, 6, 7]
self.assertEqual(expected, RoomType.list())

def test_special_rooms(self):
Expand All @@ -62,15 +62,16 @@ def test_door_color(self):

def test_room_colors(self):
expected = {
RoomType.NORMAL_ROOM: Color.VIOLET,
RoomType.DEAD_END: Color.VIOLET,
RoomType.NORMAL_ROOM: Color.LIGHT_GRAY,
RoomType.DEAD_END: Color.LIGHT_GRAY,
RoomType.ITEM_ROOM: Color.GREEN,
RoomType.SHOP_ROOM: Color.YELLOW,
RoomType.START_ROOM: Color.ORANGE,
RoomType.TELEPORT_ROOM: Color.GRAY,
RoomType.TELEPORT_ROOM: Color.VIOLET,
RoomType.BOSS_ROOM: Color.RED,
RoomType.SECRET_ROOM: Color.BLUE,
}
self.assertEqual(expected, globals.Room_Colors)
self.assertEqual(expected, room_type.room_colors)

def test_room_width(self):
self.assertEqual(120, globals.ROOM_WIDTH)
Expand All @@ -91,10 +92,8 @@ def test_json_suffix(self):
self.assertEqual(".json", globals.JSON_SUFFIX)

def test_path(self):
self.assertEqual(
os.path.realpath(os.path.dirname(__file__).replace("\\test", "")),
globals.APPLICATION_PATH,
)
project_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
self.assertEqual(project_root, globals.APPLICATION_PATH)


if __name__ == "__main__":
Expand Down
Loading