diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..0e035e7 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,29 @@ +name: Python CI with pytest + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + + - name: Run tests with pytest + run: | + pytest test_car.py diff --git a/car.py b/car.py index 09f0c46..2663741 100644 --- a/car.py +++ b/car.py @@ -26,4 +26,4 @@ def average_speed(self): if self.time == 0: raise Exception("Divide by 0! Car did not move!") else: - return self.odometer / self.time \ No newline at end of file + return self.odometer / self.time