Skip to content

Commit

Permalink
Merge branch 'develop' into develop_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
akurungadam authored Oct 22, 2024
2 parents bcd725c + ce21bc0 commit a175d77
Show file tree
Hide file tree
Showing 64 changed files with 184 additions and 155 deletions.
6 changes: 4 additions & 2 deletions .github/helper/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ sudo apt install libcups2-dev redis-server mariadb-client-10.6

pip install frappe-bench

git clone https://github.com/frappe/frappe --branch "$BRANCH_TO_CLONE" --depth 1
branchtoclone=${GITHUB_BASE_REF:-${GITHUB_REF##*/}}

git clone https://github.com/frappe/frappe --branch "${branchtoclone}" --depth 1
bench init --skip-assets --frappe-path ~/frappe --python "$(which python)" frappe-bench

mkdir ~/frappe-bench/sites/test_site
Expand Down Expand Up @@ -41,7 +43,7 @@ sed -i 's/socketio:/# socketio:/g' Procfile
sed -i 's/redis_socketio:/# redis_socketio:/g' Procfile

bench get-app payments
bench get-app https://github.com/frappe/erpnext --branch "$BRANCH_TO_CLONE"
bench get-app https://github.com/frappe/erpnext --branch "${branchtoclone}"
bench get-app healthcare "${GITHUB_WORKSPACE}"

bench setup requirements --dev
Expand Down
55 changes: 48 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
# Run everday at midnight UTC / 5:30 IST
- cron: "0 0 * * *"
env:
FH_BRANCH: ${{ github.base_ref || github.ref_name }}
MARLEY_BRANCH: ${{ github.base_ref || github.ref_name }}

concurrency:
group: develop-${{ github.event.number }}
Expand All @@ -24,11 +24,17 @@ jobs:
tests:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
NODE_ENV: "production"
WITH_COVERAGE: ${{ github.event_name != 'pull_request' }}

strategy:
fail-fast: false

name: Server
matrix:
container: [1]

name: Server Tests

services:
mysql:
Expand All @@ -40,7 +46,7 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3

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

- name: Set up Python
Expand All @@ -54,14 +60,22 @@ jobs:
node-version: 20
check-latest: true

- name: Check for valid Python & Merge Conflicts
run: |
python -m compileall -f "${GITHUB_WORKSPACE}"
if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
then echo "Found merge conflicts"
exit 1
fi
- name: Add to Hosts
run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts

- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt') }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt', '**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
Expand Down Expand Up @@ -93,11 +107,38 @@ jobs:
- name: Install
run: |
bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
cd ~/frappe-bench/ && source env/bin/activate
env:
BRANCH_TO_CLONE: ${{ env.FH_BRANCH }}
FRAPPE_USER: ${{ github.event.inputs.user }}
FRAPPE_BRANCH: ${{ github.event.inputs.branch }}

- name: Run Tests
run: cd ~/frappe-bench/ && bench --site test_site run-tests --app healthcare
run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app healthcare --total-builds ${{ strategy.job-total }} --build-number ${{ matrix.container }}
env:
TYPE: server
CAPTURE_COVERAGE: ${{ github.event_name != 'pull_request' }}

- name: Upload coverage data
uses: actions/upload-artifact@v3
if: github.event_name != 'pull_request'
with:
name: coverage-${{ matrix.container }}
path: /home/runner/frappe-bench/sites/coverage.xml

coverage:
name: Coverage Wrap Up
needs: tests
runs-on: ubuntu-latest
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Clone
uses: actions/checkout@v4

- name: Download artifacts
uses: actions/download-artifact@v3

- name: Upload coverage data
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true
8 changes: 4 additions & 4 deletions healthcare/healthcare/custom_doctype/test_sales_invoice.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase

test_records = frappe.get_test_records("Sales Invoice")
EXTRA_TEST_RECORD_DEPENDENCIES = ["Sales Invoice"]


class TestSalesInvoice(FrappeTestCase):
class TestSalesInvoice(IntegrationTestCase):
def test_set_healthcare_services_should_preserve_state(self):
invoice = frappe.copy_doc(test_records[0])
invoice = frappe.copy_doc(self.globalTestRecords["Sales Invoice"][0])

count = len(invoice.items)
item = invoice.items[0]
Expand Down
4 changes: 2 additions & 2 deletions healthcare/healthcare/doctype/antibiotic/test_antibiotic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# See license.txt


from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase


class TestAntibiotic(FrappeTestCase):
class TestAntibiotic(IntegrationTestCase):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
# See license.txt


from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase

# test_records = frappe.get_test_records('Appointment Type')


class TestAppointmentType(FrappeTestCase):
class TestAppointmentType(IntegrationTestCase):
pass
4 changes: 2 additions & 2 deletions healthcare/healthcare/doctype/body_part/test_body_part.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@


# import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase


class TestBodyPart(FrappeTestCase):
class TestBodyPart(IntegrationTestCase):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# See license.txt

# import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase


class TestClinicalNote(FrappeTestCase):
class TestClinicalNote(IntegrationTestCase):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# See license.txt

# import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase


class TestClinicalNoteType(FrappeTestCase):
class TestClinicalNoteType(IntegrationTestCase):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@


import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase

from healthcare.healthcare.doctype.patient_appointment.test_patient_appointment import (
create_clinical_procedure_template,
create_healthcare_docs,
)

test_dependencies = ["Item"]
EXTRA_TEST_RECORD_DEPENDENCIES = ["Item"]


class TestClinicalProcedure(FrappeTestCase):
class TestClinicalProcedure(IntegrationTestCase):
def test_procedure_template_item(self):
patient, practitioner = create_healthcare_docs()
procedure_template = create_clinical_procedure_template()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# See license.txt


from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase


class TestClinicalProcedureTemplate(FrappeTestCase):
class TestClinicalProcedureTemplate(IntegrationTestCase):
pass
4 changes: 2 additions & 2 deletions healthcare/healthcare/doctype/code_system/test_code_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# See license.txt


from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase


class TestCodeSystem(FrappeTestCase):
class TestCodeSystem(IntegrationTestCase):
pass
4 changes: 2 additions & 2 deletions healthcare/healthcare/doctype/code_value/test_code_value.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# See license.txt


from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase


class TestCodeValue(FrappeTestCase):
class TestCodeValue(IntegrationTestCase):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# See license.txt

# import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase


class TestCodeValueSet(FrappeTestCase):
class TestCodeValueSet(IntegrationTestCase):
pass
4 changes: 2 additions & 2 deletions healthcare/healthcare/doctype/complaint/test_complaint.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# See license.txt


from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase


class TestComplaint(FrappeTestCase):
class TestComplaint(IntegrationTestCase):
pass
6 changes: 2 additions & 4 deletions healthcare/healthcare/doctype/diagnosis/test_diagnosis.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
# See license.txt


from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase

# test_records = frappe.get_test_records('Diagnosis')


class TestDiagnosis(FrappeTestCase):
class TestDiagnosis(IntegrationTestCase):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# See license.txt

# import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase


class TestDiagnosticReport(FrappeTestCase):
class TestDiagnosticReport(IntegrationTestCase):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# See license.txt

# import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase


class TestDischargeSummary(FrappeTestCase):
class TestDischargeSummary(IntegrationTestCase):
pass
4 changes: 2 additions & 2 deletions healthcare/healthcare/doctype/dosage_form/test_dosage_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
# See license.txt


from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase


class TestDosageForm(FrappeTestCase):
class TestDosageForm(IntegrationTestCase):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@


# import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase


class TestExerciseDifficultyLevel(FrappeTestCase):
class TestExerciseDifficultyLevel(IntegrationTestCase):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@


# import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase


class TestExerciseType(FrappeTestCase):
class TestExerciseType(IntegrationTestCase):
pass
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase
from frappe.utils import add_days, nowdate

from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile
Expand All @@ -16,10 +16,10 @@
update_status,
)

test_dependencies = ["Company"]
EXTRA_TEST_RECORD_DEPENDENCIES = ["Company"]


class TestFeeValidity(FrappeTestCase):
class TestFeeValidity(IntegrationTestCase):
def setUp(self):
frappe.db.sql("""delete from `tabPatient Appointment`""")
frappe.db.sql("""delete from `tabFee Validity`""")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
# See license.txt

import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase


class TestHealthcarePractitioner(FrappeTestCase):
class TestHealthcarePractitioner(IntegrationTestCase):
def test_practitioner_mandatory_charges(self):
fieldnames = ["op_consulting_charge", "inpatient_visit_charge"]
for idx, fieldname in enumerate(fieldnames):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors
# See license.txt
import frappe
from frappe.tests.utils import FrappeTestCase
from frappe.tests import IntegrationTestCase


class TestHealthcareServiceUnit(FrappeTestCase):
class TestHealthcareServiceUnit(IntegrationTestCase):
def test_create_company_should_create_root_service_unit(self):
company = frappe.get_doc(
{
Expand Down
Loading

0 comments on commit a175d77

Please sign in to comment.