diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48211ce..49090de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/VERSION b/VERSION index 9fc80f9..448a0fa 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.2 \ No newline at end of file +0.3.4 \ No newline at end of file diff --git a/example/requirements.txt b/example/requirements.txt index fcdc35f..9d36e9e 100644 --- a/example/requirements.txt +++ b/example/requirements.txt @@ -1 +1,2 @@ -maze_runner \ No newline at end of file +# Update the version bellow with the latest found at https://github.com/matheusjardimb/maze_runner/ +maze_runner==0.3.4 \ No newline at end of file diff --git a/maze_runner/maze.py b/maze_runner/maze.py index ac6736e..7502e79 100644 --- a/maze_runner/maze.py +++ b/maze_runner/maze.py @@ -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", "") @@ -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") diff --git a/maze_runner/tests/__init__.py b/maze_runner/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/maze_runner/tests/test_validate_sample_maps.py b/maze_runner/tests/test_validate_sample_maps.py new file mode 100644 index 0000000..c915e41 --- /dev/null +++ b/maze_runner/tests/test_validate_sample_maps.py @@ -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 diff --git a/requirements.txt b/requirements.txt index 566fac6..bb8b5d6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 \ No newline at end of file diff --git a/tests/csv/multi_start.csv b/tests/csv/multi_start.csv deleted file mode 100644 index 59d9197..0000000 --- a/tests/csv/multi_start.csv +++ /dev/null @@ -1 +0,0 @@ -S,S \ No newline at end of file diff --git a/tests/test.py b/tests/test.py deleted file mode 100644 index 540285a..0000000 --- a/tests/test.py +++ /dev/null @@ -1,15 +0,0 @@ -import unittest - -from maze_runner.maze import Maze - - -class MultiStartPointException(Exception): - pass - - -class MyTestCase(unittest.TestCase): - def test1(self): - def init_maze(): - Maze("csv/multi_start.csv") - - self.assertRaises(MultiStartPointException, init_maze)