Merge pull request #25862 from surajshetty3416/parallel-distributed-testing-version-13-hotfix
This commit is contained in:
commit
24f2d58f53
69
.github/workflows/patch.yml
vendored
Normal file
69
.github/workflows/patch.yml
vendored
Normal file
@ -0,0 +1,69 @@
|
||||
name: Patch
|
||||
|
||||
on: [pull_request, workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-18.04
|
||||
|
||||
name: Patch Test
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mariadb:10.3
|
||||
env:
|
||||
MYSQL_ALLOW_EMPTY_PASSWORD: YES
|
||||
ports:
|
||||
- 3306:3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
|
||||
|
||||
steps:
|
||||
- name: Clone
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.6
|
||||
|
||||
- name: Add to Hosts
|
||||
run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
|
||||
|
||||
- name: Cache pip
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.cache/pip
|
||||
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
${{ runner.os }}-
|
||||
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
cache-name: cache-node-modules
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
|
||||
- uses: actions/cache@v2
|
||||
id: yarn-cache
|
||||
with:
|
||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Install
|
||||
run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
|
||||
|
||||
- name: Run Patch Tests
|
||||
run: cd ~/frappe-bench/ && wget http://build.erpnext.com/20171108_190013_955977f8_database.sql.gz && bench --site test_site --force restore ~/frappe-bench/20171108_190013_955977f8_database.sql.gz && bench --site test_site migrate
|
@ -1,6 +1,6 @@
|
||||
name: CI
|
||||
name: Server
|
||||
|
||||
on: [pull_request, workflow_dispatch, push]
|
||||
on: [pull_request, workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
@ -10,15 +10,9 @@ jobs:
|
||||
fail-fast: false
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- TYPE: "server"
|
||||
JOB_NAME: "Server"
|
||||
RUN_COMMAND: cd ~/frappe-bench/ && bench --site test_site run-tests --app erpnext --coverage
|
||||
- TYPE: "patch"
|
||||
JOB_NAME: "Patch"
|
||||
RUN_COMMAND: cd ~/frappe-bench/ && wget http://build.erpnext.com/20171108_190013_955977f8_database.sql.gz && bench --site test_site --force restore ~/frappe-bench/20171108_190013_955977f8_database.sql.gz && bench --site test_site migrate
|
||||
container: [1, 2, 3]
|
||||
|
||||
name: ${{ matrix.JOB_NAME }}
|
||||
name: Python Unit Tests
|
||||
|
||||
services:
|
||||
mysql:
|
||||
@ -36,7 +30,7 @@ jobs:
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.6
|
||||
python-version: 3.7
|
||||
|
||||
- name: Add to Hosts
|
||||
run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts
|
||||
@ -49,6 +43,7 @@ jobs:
|
||||
restore-keys: |
|
||||
${{ runner.os }}-pip-
|
||||
${{ runner.os }}-
|
||||
|
||||
- name: Cache node modules
|
||||
uses: actions/cache@v2
|
||||
env:
|
||||
@ -60,6 +55,7 @@ jobs:
|
||||
${{ runner.os }}-build-${{ env.cache-name }}-
|
||||
${{ runner.os }}-build-
|
||||
${{ runner.os }}-
|
||||
|
||||
- name: Get yarn cache directory path
|
||||
id: yarn-cache-dir-path
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
@ -76,33 +72,8 @@ jobs:
|
||||
run: bash ${GITHUB_WORKSPACE}/.github/helper/install.sh
|
||||
|
||||
- name: Run Tests
|
||||
run: ${{ matrix.RUN_COMMAND }}
|
||||
run: cd ~/frappe-bench/ && bench --site test_site run-parallel-tests --app erpnext --use-orchestrator --with-coverage
|
||||
env:
|
||||
TYPE: ${{ matrix.TYPE }}
|
||||
|
||||
- name: Coverage - Pull Request
|
||||
if: matrix.TYPE == 'server' && github.event_name == 'pull_request'
|
||||
run: |
|
||||
cp ~/frappe-bench/sites/.coverage ${GITHUB_WORKSPACE}
|
||||
cd ${GITHUB_WORKSPACE}
|
||||
pip install coveralls==2.2.0
|
||||
pip install coverage==4.5.4
|
||||
coveralls --service=github
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
|
||||
COVERALLS_SERVICE_NAME: github
|
||||
|
||||
- name: Coverage - Push
|
||||
if: matrix.TYPE == 'server' && github.event_name == 'push'
|
||||
run: |
|
||||
cp ~/frappe-bench/sites/.coverage ${GITHUB_WORKSPACE}
|
||||
cd ${GITHUB_WORKSPACE}
|
||||
pip install coveralls==2.2.0
|
||||
pip install coverage==4.5.4
|
||||
coveralls --service=github-actions
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
|
||||
COVERALLS_SERVICE_NAME: github-actions
|
||||
|
||||
TYPE: server
|
||||
CI_BUILD_ID: ${{ github.run_id }}
|
||||
ORCHESTRATOR_URL: http://test-orchestrator.frappe.io
|
@ -7,7 +7,8 @@ import frappe
|
||||
import unittest
|
||||
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
|
||||
from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
|
||||
from erpnext.accounts.doctype.accounting_dimension.accounting_dimension import delete_accounting_dimension
|
||||
|
||||
test_dependencies = ['Cost Center', 'Location', 'Warehouse', 'Department']
|
||||
|
||||
class TestAccountingDimension(unittest.TestCase):
|
||||
def setUp(self):
|
||||
|
@ -9,6 +9,8 @@ from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sal
|
||||
from erpnext.accounts.doctype.accounting_dimension.test_accounting_dimension import create_dimension, disable_dimension
|
||||
from erpnext.exceptions import InvalidAccountDimensionError, MandatoryAccountDimensionError
|
||||
|
||||
test_dependencies = ['Location', 'Cost Center', 'Department']
|
||||
|
||||
class TestAccountingDimensionFilter(unittest.TestCase):
|
||||
def setUp(self):
|
||||
create_dimension()
|
||||
|
@ -10,6 +10,8 @@ from erpnext.accounts.general_ledger import ClosedAccountingPeriod
|
||||
from erpnext.accounts.doctype.accounting_period.accounting_period import OverlapError
|
||||
from erpnext.accounts.doctype.sales_invoice.test_sales_invoice import create_sales_invoice
|
||||
|
||||
test_dependencies = ['Item']
|
||||
|
||||
class TestAccountingPeriod(unittest.TestCase):
|
||||
def test_overlap(self):
|
||||
ap1 = create_accounting_period(start_date = "2018-04-01",
|
||||
@ -38,7 +40,7 @@ def create_accounting_period(**args):
|
||||
accounting_period.start_date = args.start_date or nowdate()
|
||||
accounting_period.end_date = args.end_date or add_months(nowdate(), 1)
|
||||
accounting_period.company = args.company or "_Test Company"
|
||||
accounting_period.period_name =args.period_name or "_Test_Period_Name_1"
|
||||
accounting_period.period_name = args.period_name or "_Test_Period_Name_1"
|
||||
accounting_period.append("closed_documents", {
|
||||
"document_type": 'Sales Invoice', "closed": 1
|
||||
})
|
||||
|
@ -11,6 +11,8 @@ from erpnext.buying.doctype.purchase_order.test_purchase_order import create_pur
|
||||
from erpnext.accounts.doctype.budget.budget import get_actual_expense, BudgetError
|
||||
from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
|
||||
|
||||
test_dependencies = ['Monthly Distribution']
|
||||
|
||||
class TestBudget(unittest.TestCase):
|
||||
def test_monthly_budget_crossed_ignore(self):
|
||||
set_total_expense_zero(nowdate(), "cost_center")
|
||||
|
@ -152,7 +152,7 @@ class PricingRule(Document):
|
||||
frappe.throw(_("Valid from date must be less than valid upto date"))
|
||||
|
||||
def validate_condition(self):
|
||||
if self.condition and ("=" in self.condition) and re.match("""[\w\.:_]+\s*={1}\s*[\w\.@'"]+""", self.condition):
|
||||
if self.condition and ("=" in self.condition) and re.match(r'[\w\.:_]+\s*={1}\s*[\w\.@\'"]+', self.condition):
|
||||
frappe.throw(_("Invalid condition expression"))
|
||||
|
||||
#--------------------------------------------------------------------------------
|
||||
|
@ -636,8 +636,8 @@ class TestPurchaseInvoice(unittest.TestCase):
|
||||
|
||||
def test_rejected_serial_no(self):
|
||||
pi = make_purchase_invoice(item_code="_Test Serialized Item With Series", received_qty=2, qty=1,
|
||||
rejected_qty=1, rate=500, update_stock=1,
|
||||
rejected_warehouse = "_Test Rejected Warehouse - _TC")
|
||||
rejected_qty=1, rate=500, update_stock=1, rejected_warehouse = "_Test Rejected Warehouse - _TC",
|
||||
allow_zero_valuation_rate=1)
|
||||
|
||||
self.assertEqual(frappe.db.get_value("Serial No", pi.get("items")[0].serial_no, "warehouse"),
|
||||
pi.get("items")[0].warehouse)
|
||||
@ -994,7 +994,8 @@ def make_purchase_invoice(**args):
|
||||
"project": args.project,
|
||||
"rejected_warehouse": args.rejected_warehouse or "",
|
||||
"rejected_serial_no": args.rejected_serial_no or "",
|
||||
"asset_location": args.location or ""
|
||||
"asset_location": args.location or "",
|
||||
"allow_zero_valuation_rate": args.get("allow_zero_valuation_rate") or 0
|
||||
})
|
||||
|
||||
if args.get_taxes_and_charges:
|
||||
|
@ -9,12 +9,12 @@ from erpnext.stock.doctype.stock_entry.test_stock_entry import make_stock_entry
|
||||
from erpnext.buying.report.subcontracted_raw_materials_to_be_transferred.subcontracted_raw_materials_to_be_transferred import execute
|
||||
import json, frappe, unittest
|
||||
|
||||
class TestSubcontractedItemToBeReceived(unittest.TestCase):
|
||||
class TestSubcontractedItemToBeTransferred(unittest.TestCase):
|
||||
|
||||
def test_pending_and_received_qty(self):
|
||||
def test_pending_and_transferred_qty(self):
|
||||
po = create_purchase_order(item_code='_Test FG Item', is_subcontracted='Yes')
|
||||
make_stock_entry(item_code='_Test Item', target='_Test Warehouse 1 - _TC', qty=100, basic_rate=100)
|
||||
make_stock_entry(item_code='_Test Item Home Desktop 100', target='_Test Warehouse 1 - _TC', qty=100, basic_rate=100)
|
||||
make_stock_entry(item_code='_Test Item', target='_Test Warehouse - _TC', qty=100, basic_rate=100)
|
||||
make_stock_entry(item_code='_Test Item Home Desktop 100', target='_Test Warehouse - _TC', qty=100, basic_rate=100)
|
||||
transfer_subcontracted_raw_materials(po.name)
|
||||
col, data = execute(filters=frappe._dict({'supplier': po.supplier,
|
||||
'from_date': frappe.utils.get_datetime(frappe.utils.add_to_date(po.transaction_date, days=-10)),
|
||||
@ -38,6 +38,7 @@ def transfer_subcontracted_raw_materials(po):
|
||||
'warehouse': '_Test Warehouse - _TC', 'rate': 100, 'amount': 200, 'stock_uom': 'Nos'}]
|
||||
rm_item_string = json.dumps(rm_item)
|
||||
se = frappe.get_doc(make_rm_stock_entry(po, rm_item_string))
|
||||
se.from_warehouse = '_Test Warehouse 1 - _TC'
|
||||
se.to_warehouse = '_Test Warehouse 1 - _TC'
|
||||
se.stock_entry_type = 'Send to Subcontractor'
|
||||
se.save()
|
||||
|
@ -1011,7 +1011,6 @@ class AccountsController(TransactionBase):
|
||||
else:
|
||||
grand_total -= self.get("total_advance")
|
||||
base_grand_total = flt(grand_total * self.get("conversion_rate"), self.precision("base_grand_total"))
|
||||
|
||||
if total != flt(grand_total, self.precision("grand_total")) or \
|
||||
base_total != flt(base_grand_total, self.precision("base_grand_total")):
|
||||
frappe.throw(_("Total Payment Amount in Payment Schedule must be equal to Grand / Rounded Total"))
|
||||
|
@ -9,8 +9,7 @@ from frappe.utils import nowdate
|
||||
from frappe.utils.make_random import get_random
|
||||
from erpnext.education.doctype.program.test_program import make_program_and_linked_courses
|
||||
|
||||
# test_records = frappe.get_test_records('Fees')
|
||||
|
||||
test_dependencies = ['Company']
|
||||
class TestFees(unittest.TestCase):
|
||||
|
||||
def test_fees(self):
|
||||
|
@ -5,11 +5,18 @@ from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
import erpnext
|
||||
from frappe.utils import getdate
|
||||
from erpnext.hr.doctype.upload_attendance.upload_attendance import get_data
|
||||
from erpnext.hr.doctype.employee.test_employee import make_employee
|
||||
|
||||
test_dependencies = ['Holiday List']
|
||||
|
||||
class TestUploadAttendance(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
frappe.db.set_value("Company", erpnext.get_default_company(), "default_holiday_list", '_Test Holiday List')
|
||||
|
||||
def test_date_range(self):
|
||||
employee = make_employee("test_employee@company.com")
|
||||
employee_doc = frappe.get_doc("Employee", employee)
|
||||
|
@ -15,7 +15,13 @@ from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_
|
||||
from erpnext.loan_management.doctype.loan.test_loan import create_loan, make_loan_disbursement_entry, create_loan_type, create_loan_accounts
|
||||
from erpnext.loan_management.doctype.process_loan_interest_accrual.process_loan_interest_accrual import process_loan_interest_accrual_for_term_loans
|
||||
|
||||
test_dependencies = ['Holiday List']
|
||||
|
||||
class TestPayrollEntry(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
frappe.db.set_value("Company", erpnext.get_default_company(), "default_holiday_list", '_Test Holiday List')
|
||||
|
||||
def setUp(self):
|
||||
for dt in ["Salary Slip", "Salary Component", "Salary Component Account",
|
||||
"Payroll Entry", "Salary Structure", "Salary Structure Assignment", "Payroll Employee Detail", "Additional Salary"]:
|
||||
|
@ -500,7 +500,7 @@ def download_ewb_json():
|
||||
|
||||
if not isinstance(docname, list):
|
||||
# removes characters not allowed in a filename (https://stackoverflow.com/a/38766141/4767738)
|
||||
filename_prefix = re.sub('[^\w_.)( -]', '', docname)
|
||||
filename_prefix = re.sub(r'[^\w_.)( -]', '', docname)
|
||||
|
||||
frappe.local.response.filename = '{0}_e-WayBill_Data_{1}.json'.format(filename_prefix, frappe.utils.random_string(5))
|
||||
|
||||
|
@ -249,7 +249,7 @@ class EmailDigest(Document):
|
||||
card = cache.get(cache_key)
|
||||
|
||||
if card:
|
||||
card = eval(card)
|
||||
card = frappe.safe_eval(card)
|
||||
|
||||
else:
|
||||
card = frappe._dict(getattr(self, "get_" + key)())
|
||||
@ -808,7 +808,6 @@ def get_incomes_expenses_for_period(account, from_date, to_date):
|
||||
val = balance_on_to_date - balance_before_from_date
|
||||
else:
|
||||
last_year_closing_balance = get_balance_on(account, date=fy_start_date - timedelta(days=1))
|
||||
print(fy_start_date - timedelta(days=1), last_year_closing_balance)
|
||||
val = balance_on_to_date + (last_year_closing_balance - balance_before_from_date)
|
||||
|
||||
return val
|
||||
|
@ -7,7 +7,7 @@ import frappe
|
||||
from frappe.utils import nowdate, add_months
|
||||
from erpnext.shopping_cart.cart import _get_cart_quotation, update_cart, get_party
|
||||
from erpnext.tests.utils import create_test_contact_and_address
|
||||
|
||||
from erpnext.accounts.doctype.tax_rule.tax_rule import ConflictingTaxRule
|
||||
|
||||
# test_dependencies = ['Payment Terms Template']
|
||||
|
||||
@ -125,7 +125,7 @@ class TestShoppingCart(unittest.TestCase):
|
||||
tax_rule = frappe.get_test_records("Tax Rule")[0]
|
||||
try:
|
||||
frappe.get_doc(tax_rule).insert()
|
||||
except frappe.DuplicateEntryError:
|
||||
except (frappe.DuplicateEntryError, ConflictingTaxRule):
|
||||
pass
|
||||
|
||||
def create_quotation(self):
|
||||
|
@ -297,6 +297,8 @@ class TestPurchaseReceipt(unittest.TestCase):
|
||||
item_code = "Test Extra Item 1", qty=10, basic_rate=100)
|
||||
se2 = make_stock_entry(target="_Test Warehouse - _TC",
|
||||
item_code = "_Test FG Item", qty=1, basic_rate=100)
|
||||
se3 = make_stock_entry(target="_Test Warehouse - _TC",
|
||||
item_code = "Test Extra Item 2", qty=1, basic_rate=100)
|
||||
rm_items = [
|
||||
{
|
||||
"item_code": item_code,
|
||||
@ -331,6 +333,7 @@ class TestPurchaseReceipt(unittest.TestCase):
|
||||
se.cancel()
|
||||
se1.cancel()
|
||||
se2.cancel()
|
||||
se3.cancel()
|
||||
po.reload()
|
||||
po.cancel()
|
||||
|
||||
|
@ -15,10 +15,12 @@ from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_pu
|
||||
from erpnext.stock.doctype.landed_cost_voucher.test_landed_cost_voucher import create_landed_cost_voucher
|
||||
from erpnext.stock.doctype.delivery_note.test_delivery_note import create_delivery_note
|
||||
from erpnext.stock.doctype.stock_ledger_entry.stock_ledger_entry import BackDatedStockTransaction
|
||||
from frappe.core.page.permission_manager.permission_manager import reset
|
||||
|
||||
class TestStockLedgerEntry(unittest.TestCase):
|
||||
def setUp(self):
|
||||
items = create_items()
|
||||
reset('Stock Entry')
|
||||
|
||||
# delete SLE and BINs for all items
|
||||
frappe.db.sql("delete from `tabStock Ledger Entry` where item_code in (%s)" % (', '.join(['%s']*len(items))), items)
|
||||
@ -314,10 +316,11 @@ class TestStockLedgerEntry(unittest.TestCase):
|
||||
# Set User with Stock User role but not Stock Manager
|
||||
try:
|
||||
user = frappe.get_doc("User", "test@example.com")
|
||||
frappe.set_user(user.name)
|
||||
user.add_roles("Stock User")
|
||||
user.remove_roles("Stock Manager")
|
||||
|
||||
frappe.set_user(user.name)
|
||||
|
||||
stock_entry_on_today = make_stock_entry(target="_Test Warehouse - _TC", qty=10, basic_rate=100)
|
||||
back_dated_se_1 = make_stock_entry(target="_Test Warehouse - _TC", qty=10, basic_rate=100,
|
||||
posting_date=add_days(today(), -1), do_not_submit=True)
|
||||
|
@ -194,9 +194,6 @@ def set_stock_balance_as_per_serial_no(item_code=None, posting_date=None, postin
|
||||
serial_nos = frappe.db.sql("""select count(name) from `tabSerial No`
|
||||
where item_code=%s and warehouse=%s and docstatus < 2""", (d[0], d[1]))
|
||||
|
||||
if serial_nos and flt(serial_nos[0][0]) != flt(d[2]):
|
||||
print(d[0], d[1], d[2], serial_nos[0][0])
|
||||
|
||||
sle = frappe.db.sql("""select valuation_rate, company from `tabStock Ledger Entry`
|
||||
where item_code = %s and warehouse = %s and is_cancelled = 0
|
||||
order by posting_date desc limit 1""", (d[0], d[1]))
|
||||
|
@ -0,0 +1 @@
|
||||
global_test_dependencies = ['User', 'Company', 'Item']
|
@ -12,7 +12,6 @@ def update_doctypes():
|
||||
|
||||
for f in dt.fields:
|
||||
if f.fieldname == d.fieldname and f.fieldtype in ("Text", "Small Text"):
|
||||
print(f.parent, f.fieldname)
|
||||
f.fieldtype = "Text Editor"
|
||||
dt.save()
|
||||
break
|
||||
|
Loading…
x
Reference in New Issue
Block a user