Skip to content

Commit

Permalink
Merge pull request #30 from matheusjardimb/test_setup
Browse files Browse the repository at this point in the history
Initial test setup
  • Loading branch information
matheusjardimb authored Aug 27, 2024
2 parents 0a369e4 + 1ea85bd commit 1cce200
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 22 deletions.
19 changes: 18 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,23 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
python-version-file: '.python-version'

- name: Run pre-commit
uses: pre-commit/action@v3.0.1

pytest:
runs-on: ubuntu-latest

steps:
- name: Checkout Code Repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version-file: '.python-version'
cache: 'pip' # caching pip dependencies

- run: pip install -r requirements.txt
- run: pytest
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.2
0.3.4
3 changes: 2 additions & 1 deletion example/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
maze_runner
# Update the version bellow with the latest found at https://github.com/matheusjardimb/maze_runner/
maze_runner==0.3.4
2 changes: 0 additions & 2 deletions maze_runner/maze.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def __init__(
# Start loading Maze file
with open(maze_file_path) as file:
lines = file.readlines()
line_count = 0

for y_pos, cells in enumerate(lines):
cells = cells.replace("\n", "")
Expand All @@ -61,7 +60,6 @@ def __init__(
self.__finish_positions.append(Position(x=x_pos, y=y_pos))
row.append(1 if cell == self.WALL_MARKER else 0)
self.__maze.append(row)
print(f"Processed {line_count} lines.")

if len(self.__finish_positions) == 0:
raise Exception("Map has no finishing cells")
Expand Down
Empty file added maze_runner/tests/__init__.py
Empty file.
11 changes: 11 additions & 0 deletions maze_runner/tests/test_validate_sample_maps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import os
import glob

from ..maze import Maze


def test_validate_sample_maps():
folder_path = "../maps"
txt_files = glob.glob(os.path.join(folder_path, "*.txt"))
for file in txt_files:
Maze(file) # Simply instantiate a maze using each map
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ matplotlib==3.9.1
numpy==2.0.1

# Tests
# pytest==7.3.1
pytest==8.3.2
# pytest-cov==5.0.0
1 change: 0 additions & 1 deletion tests/csv/multi_start.csv

This file was deleted.

15 changes: 0 additions & 15 deletions tests/test.py

This file was deleted.

0 comments on commit 1cce200

Please sign in to comment.