Skip to content

Commit

Permalink
refactor: pyproject.toml to poetry (#99)
Browse files Browse the repository at this point in the history
* refactor: pyproject.toml to poetry

* fix: move dev dependencies

* format: conftest.py

* fix: poetry install before running tests

* fix: poetry install before running tests

* fix: permissions for job
  • Loading branch information
MyuddinKhatri authored and agritheory committed Jul 13, 2024
1 parent 4c81808 commit 7b932cb
Show file tree
Hide file tree
Showing 5 changed files with 316 additions and 23 deletions.
21 changes: 19 additions & 2 deletions .github/workflows/pytest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ on:
- version-14
- version-15

permissions:
contents: write
checks: write
issues: write
pull-requests: write

jobs:
tests:
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -44,7 +50,7 @@ jobs:
node-version: 20
check-latest: true
cache: 'yarn' # Replaces `Get yarn cache directory path` and `yarn-cache` steps

# Uncomment if running locally, remove after local testing (already available in github actions environment)
# - name: Install Yarn
# run: npm install -g yarn
Expand Down Expand Up @@ -73,6 +79,9 @@ jobs:
# restore-keys: |
# ${{ runner.os }}-yarn-

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install JS Dependencies
run: yarn --prefer-offline

Expand All @@ -90,4 +99,12 @@ jobs:
working-directory: /home/runner/frappe-bench
run: |
source env/bin/activate
pytest ./apps/inventory_tools/inventory_tools/tests/ --disable-warnings -s
cd apps/inventory_tools
poetry install
pytest --cov=inventory_tools --cov-report=xml --disable-warnings -s | tee pytest-coverage.txt
- name: Pytest coverage comment
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: /home/runner/frappe-bench/apps/inventory_tools/pytest-coverage.txt
junitxml-path: /home/runner/frappe-bench/apps/inventory_tools/coverage.xml
16 changes: 10 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,18 @@ repos:
- id: flake8
additional_dependencies: ['flake8-bugbear']

- repo: local
- repo: https://github.com/agritheory/test_utils
rev: v0.11.0
hooks:
- id: validate_copyright
files: '\.(js|ts|py|md)$'
args: ["--app", "inventory_tools"]
- id: clean_customized_doctypes
args: ["--app", "inventory_tools"]
- id: validate_customizations
always_run: true
name: .github/validate_customizations.py
entry: python .github/validate_customizations.py
language: system
types: [python]
args: ["--set-module", "True"]
- id: validate_python_dependencies
- id: validate_javascript_dependencies

ci:
autoupdate_schedule: weekly
Expand Down
3 changes: 1 addition & 2 deletions inventory_tools/tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
from pathlib import Path
from unittest.mock import MagicMock
import json

import frappe
import pytest
Expand Down Expand Up @@ -40,4 +40,3 @@ def db_instance():
frappe.connect()
frappe.db.commit = MagicMock()
yield frappe.db

Loading

0 comments on commit 7b932cb

Please sign in to comment.