diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 00000000..98120817 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,25 @@ +name: Update Coverage in README + +on: [push] + +jobs: + update-readme: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.8" + - name: Install dependencies + run: | + pip install pytest pytest-cov + - name: Run pytest and update README + run: | + coverage=$(pytest --cov=app --cov-report=term tests/ | tail -n 1 | awk '{print $4}') + sed -i "s/coverage: [0-9]*%/coverage: $coverage/" README.md + - name: Commit and push if changed + run: | + git config --global user.email "you@example.com" + git config --global user.name "Your Name" + git commit -am "Update coverage in README" && git push || echo "No changes to commit" diff --git a/README.md b/README.md index 5f157806..b237ba06 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # GAME (Goals And Motivation Engine) 🎮 +Coverage: [0-9]\*% + ## Description 📝 GAME (Goals And Motivation Engine) is a system designed to foster motivation and achievement of goals through gamification. This open-source project utilizes a PostgreSQL database and is developed with FastAPI in Python, managed via Poetry for environment handling. diff --git a/app/core/test_config.py b/app/core/test_config.py new file mode 100644 index 00000000..e69de29b diff --git a/app/model/base_model.py b/app/model/base_model.py index e330ab65..2027c309 100644 --- a/app/model/base_model.py +++ b/app/model/base_model.py @@ -35,10 +35,9 @@ def __repr__(self): return f"BaseModel: (id={self.id}, created_at={self.created_at}, updated_at={self.updated_at})" def __eq__(self, other): - if not isinstance(other, BaseModel): - return False return ( - self.id == other.id + isinstance(other, BaseModel) + and self.id == other.id and self.created_at == other.created_at and self.updated_at == other.updated_at )