Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions .github/helper/post_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/bin/bash

set -e

# Check for merge conflicts before proceeding
python -m compileall -f "${GITHUB_WORKSPACE}"
if grep -lr --exclude-dir=node_modules "^<<<<<<< " "${GITHUB_WORKSPACE}"
then echo "Found merge conflicts"
exit 1
fi

cd ~ || exit

echo "Setting Up System Dependencies..."

sudo apt update

sudo apt remove mysql-server mysql-client
sudo apt install libcups2-dev redis-server mariadb-client
Comment on lines +16 to +19
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Add -y flag to apt commands to prevent interactive prompts in CI.

The apt remove and apt install commands will prompt for confirmation, causing the CI workflow to hang indefinitely. Add the -y flag for non-interactive execution.

Proposed fix
 sudo apt update
 
-sudo apt remove mysql-server mysql-client
-sudo apt install libcups2-dev redis-server mariadb-client
+sudo apt remove -y mysql-server mysql-client
+sudo apt install -y libcups2-dev redis-server mariadb-client
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
sudo apt update
sudo apt remove mysql-server mysql-client
sudo apt install libcups2-dev redis-server mariadb-client
sudo apt update
sudo apt remove -y mysql-server mysql-client
sudo apt install -y libcups2-dev redis-server mariadb-client
🤖 Prompt for AI Agents
In @.github/helper/post_install.sh around lines 16 - 19, Update the apt commands
to run non-interactively: modify the commands "sudo apt remove mysql-server
mysql-client" and "sudo apt install libcups2-dev redis-server mariadb-client" to
include the -y flag (e.g., "sudo apt remove -y ..." and "sudo apt install -y
...") so the script won’t prompt during CI runs.

Comment on lines +18 to +19
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

apt remove may fail if MySQL packages aren't installed.

With set -e enabled, if mysql-server or mysql-client aren't installed, this command could exit with a non-zero status and terminate the script. Consider using || true to ignore errors, or the --ignore-missing flag (available in newer apt versions).

Proposed fix
-sudo apt remove mysql-server mysql-client
+sudo apt remove mysql-server mysql-client || true
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
sudo apt remove mysql-server mysql-client
sudo apt install libcups2-dev redis-server mariadb-client
sudo apt remove mysql-server mysql-client || true
sudo apt install libcups2-dev redis-server mariadb-client
🤖 Prompt for AI Agents
In @.github/helper/post_install.sh around lines 18 - 19, The sudo apt remove
mysql-server mysql-client command can fail under set -e if those packages are
not installed; update that invocation in .github/helper/post_install.sh (the apt
remove line) to tolerate missing packages by either adding a fallback (e.g.,
append || true) or switching to an apt/apt-get option that ignores missing
packages (such as --ignore-missing or using apt-get remove -y with error
suppression), ensuring the script does not exit on a non-zero status when MySQL
packages are absent.


install_whktml() {
wget -O /tmp/wkhtmltox.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
sudo apt install /tmp/wkhtmltox.deb
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Add -y flag for non-interactive wkhtmltopdf installation.

The apt install inside the background function also needs the -y flag.

Proposed fix
-    sudo apt install /tmp/wkhtmltox.deb
+    sudo apt install -y /tmp/wkhtmltox.deb
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
sudo apt install /tmp/wkhtmltox.deb
sudo apt install -y /tmp/wkhtmltox.deb
🤖 Prompt for AI Agents
In @.github/helper/post_install.sh at line 23, The apt install command in the
background installer currently runs interactively ("sudo apt install
/tmp/wkhtmltox.deb"); update that invocation to be non-interactive by adding the
-y flag (change to "sudo apt install -y /tmp/wkhtmltox.deb") and apply the same
-y flag to any other apt install calls inside the same background function so
the script can run unattended.

}
Comment on lines +21 to +24
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Typo in function name and missing -y flag.

The function name install_whktml has a typo (should be install_wkhtmltopdf or similar). Additionally, the apt install inside the function needs the -y flag for non-interactive execution.

🔧 Proposed fix
-install_whktml() {
+install_wkhtmltopdf() {
     wget -O /tmp/wkhtmltox.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
-    sudo apt install /tmp/wkhtmltox.deb
+    sudo apt install /tmp/wkhtmltox.deb -y
 }
-install_whktml &
+install_wkhtmltopdf &
🤖 Prompt for AI Agents
In @.github/helper/post_install.sh around lines 21 - 24, The function name
install_whktml is misspelled and the apt call is missing the non-interactive
flag; rename the function to install_wkhtmltopdf (or install_wkhtmltox if you
prefer that naming) and update any calls to it, and change the install line to
use sudo apt install -y /tmp/wkhtmltox.deb so the package installs
non-interactively; keep the wget download as-is but ensure any references to
install_whktml are updated to the new function name.

install_whktml &
Comment on lines +21 to +25
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Typo in function name and missing -y flag.

The function name has a typo (whktml instead of wkhtmltopdf), and the apt install inside needs -y for non-interactive execution.

Suggested fix
-install_whktml() {
+install_wkhtmltopdf() {
     wget -O /tmp/wkhtmltox.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
-    sudo apt install /tmp/wkhtmltox.deb
+    sudo apt install -y /tmp/wkhtmltox.deb
 }
-install_whktml &
+install_wkhtmltopdf &
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
install_whktml() {
wget -O /tmp/wkhtmltox.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
sudo apt install /tmp/wkhtmltox.deb
}
install_whktml &
install_wkhtmltopdf() {
wget -O /tmp/wkhtmltox.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
sudo apt install -y /tmp/wkhtmltox.deb
}
install_wkhtmltopdf &
🤖 Prompt for AI Agents
In @.github/helper/post_install.sh around lines 21 - 25, Rename the function
install_whktml to install_wkhtmltopdf and update its invocation to
install_wkhtmltopdf &, and make the apt call non-interactive by adding the -y
flag (e.g., sudo apt install -y /tmp/wkhtmltox.deb); keep the wget usage the
same but ensure the function name and background caller match the corrected
identifier.

wkpid=$!
Comment on lines +21 to +26
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Fix typo in function name and add -y flag.

The function name install_whktml appears to be a typo. Also, the apt install inside needs -y for non-interactive execution.

Proposed fix
-install_whktml() {
+install_wkhtmltox() {
     wget -O /tmp/wkhtmltox.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
-    sudo apt install /tmp/wkhtmltox.deb
+    sudo apt install -y /tmp/wkhtmltox.deb
 }
-install_whktml &
+install_wkhtmltox &
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
install_whktml() {
wget -O /tmp/wkhtmltox.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
sudo apt install /tmp/wkhtmltox.deb
}
install_whktml &
wkpid=$!
install_wkhtmltox() {
wget -O /tmp/wkhtmltox.deb https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
sudo apt install -y /tmp/wkhtmltox.deb
}
install_wkhtmltox &
wkpid=$!
🤖 Prompt for AI Agents
In @.github/helper/post_install.sh around lines 21 - 26, Rename the function
install_whktml to install_wkhtml (and update its invocation) to fix the typo,
and make the apt install call non-interactive by adding the -y flag (i.e.,
change the command inside install_wkhtml to use sudo apt install -y
/tmp/wkhtmltox.deb); ensure the background call and wkpid=$! still reference the
corrected function name.


pip install frappe-bench

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

mkdir ~/frappe-bench/sites/test_site

cp -r "${GITHUB_WORKSPACE}/.github/helper/site_config.json" ~/frappe-bench/sites/test_site/


mariadb --host 127.0.0.1 --port 3306 -u root -ptravis -e "
SET GLOBAL character_set_server = 'utf8mb4';
SET GLOBAL collation_server = 'utf8mb4_unicode_ci';

CREATE USER 'test_resilient'@'localhost' IDENTIFIED BY 'test_resilient';
CREATE DATABASE test_resilient;
GRANT ALL PRIVILEGES ON \`test_resilient\`.* TO 'test_resilient'@'localhost';

FLUSH PRIVILEGES;
"

cd ~/frappe-bench || exit

sed -i 's/watch:/# watch:/g' Procfile
sed -i 's/schedule:/# schedule:/g' Procfile
sed -i 's/socketio:/# socketio:/g' Procfile
sed -i 's/redis_socketio:/# redis_socketio:/g' Procfile

bench get-app erpnext --branch "$BRANCH_TO_CLONE" --resolve-deps
bench setup requirements --dev

wait $wkpid

bench use test_site
bench start &
bench reinstall --yes
Comment on lines +61 to +63
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Potential race condition: bench reinstall may run before bench is ready.

bench start & spawns the server in the background, but bench reinstall --yes executes immediately without waiting for the server to be fully initialized. This could cause intermittent failures.

Proposed fix: Add a delay or readiness check
 bench use test_site
 bench start &
+
+# Wait for bench to be ready
+sleep 10
+
 bench reinstall --yes

Alternatively, consider using a more robust readiness check:

 bench use test_site
 bench start &
+
+# Wait for bench to be ready
+until curl -s http://localhost:8000 > /dev/null 2>&1; do
+    echo "Waiting for bench to start..."
+    sleep 2
+done
+
 bench reinstall --yes
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
bench use test_site
bench start &
bench reinstall --yes
bench use test_site
bench start &
# Wait for bench to be ready
sleep 10
bench reinstall --yes
🤖 Prompt for AI Agents
In @.github/helper/post_install.sh around lines 61 - 63, The script runs "bench
start &" then immediately runs "bench reinstall --yes", causing a race; modify
the post_install.sh sequence so that after invoking bench start (the "bench
start &" background job) you block until the bench server is ready before
running "bench reinstall --yes" — implement a readiness check (e.g., poll an
HTTP health endpoint such as a frappe/bench API or curl
localhost:8000/api/method/frappe.ping until it returns success, or loop checking
the port is open) with a timeout and error handling, then proceed to run "bench
reinstall --yes"; ensure you reference the existing commands ("bench start &",
"bench reinstall --yes", and "bench use test_site") when updating the script.

Comment on lines +62 to +63
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Race condition: bench reinstall may run before server is ready.

bench start & spawns the server in the background, but bench reinstall --yes executes immediately without waiting for the server to be fully operational. This can cause intermittent failures if the server isn't ready to handle requests.

Proposed fix - add a readiness check
 bench start &
+
+# Wait for the server to be ready
+timeout 60 bash -c 'until curl -s http://localhost:8000 > /dev/null 2>&1; do sleep 2; done'
+
 bench reinstall --yes
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
bench start &
bench reinstall --yes
bench start &
# Wait for the server to be ready
timeout 60 bash -c 'until curl -s http://localhost:8000 > /dev/null 2>&1; do sleep 2; done'
bench reinstall --yes
🤖 Prompt for AI Agents
In @.github/helper/post_install.sh around lines 62 - 63, The current script
launches the server with "bench start &" then immediately runs "bench reinstall
--yes", causing a race; change the flow to start the server in the background,
then wait for the server to become healthy before running reinstall. Implement a
readiness loop after "bench start &" that polls the local server (e.g., curl or
wget against the site root or a health endpoint such as /api/method/frappe.ping)
with retries and a timeout, proceeding to run "bench reinstall --yes" only once
a successful response is received; abort with a clear error if the timeout is
reached.


# Get India Compliance AFTER reinstall (so it's not installed during reinstall)
bench get-app india_compliance "${GITHUB_WORKSPACE}"

# Create an India company BEFORE installing India Compliance
echo "Creating India Company..."
cd ~/frappe-bench/sites
../env/bin/python -c "
import frappe
frappe.init('test_site')
frappe.connect()
import sys
sys.path.insert(0, '${GITHUB_WORKSPACE}')
from india_compliance.tests import setup_post_install_test_data
setup_post_install_test_data()
frappe.db.commit()
"
cd ~/frappe-bench

# Install India Compliance
echo "Installing India Compliance..."
bench --verbose install-app india_compliance

bench add-to-hosts

echo "Post-install patches test setup complete!"
107 changes: 107 additions & 0 deletions .github/workflows/post-install-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Post Install Patches Tests

on:
workflow_call:
inputs:
base_ref:
type: string


pull_request:
paths-ignore:
- "**.css"
- "**.js"
- "**.md"
- "**.html"
- "**.csv"

push:
branches: [develop, version-14-hotfix, version-14, version-15-hotfix, version-15]
paths-ignore:
- "**.css"
- "**.js"
- "**.md"
- "**.html"
- "**.csv"
env:
BRANCH: ${{ inputs.base_ref || github.base_ref || github.ref_name }}

jobs:
post-install-tests:
runs-on: ubuntu-latest
timeout-minutes: 30

strategy:
fail-fast: false

name: Post Install Patches

services:
mariadb:
image: mariadb:11.8
env:
MARIADB_ROOT_PASSWORD: 'travis'
ports:
- 3306:3306
options: --health-cmd="mariadb-admin ping" --health-interval=5s --health-timeout=2s --health-retries=3

steps:
- name: Clone
uses: actions/checkout@v6

- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.14"

- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: 24
check-latest: true

- name: Add to Hosts
run: echo "127.0.0.1 test_site" | sudo tee -a /etc/hosts

- name: Cache pip
uses: actions/cache@v5
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@v5
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 "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT

- uses: actions/cache@v5
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 with Post Install Patches
run: |
bash ${GITHUB_WORKSPACE}/.github/helper/post_install.sh
env:
BRANCH_TO_CLONE: ${{ env.BRANCH }}

- name: Show bench output
if: ${{ always() }}
run: cat ~/frappe-bench/bench_start.log || true
Comment on lines +105 to +107
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

bench_start.log is never created.

The workflow tries to display ~/frappe-bench/bench_start.log, but post_install.sh runs bench start & without redirecting output to this file. The log file won't exist.

Update post_install.sh to redirect bench output:

-bench start &
+bench start > ~/frappe-bench/bench_start.log 2>&1 &
🤖 Prompt for AI Agents
In @.github/workflows/post-install-tests.yml around lines 105 - 107, The
workflow shows ~/frappe-bench/bench_start.log but post_install.sh starts the
bench with `bench start &` without redirection so the log is never created;
update post_install.sh to start the bench with its stdout/stderr redirected into
~/frappe-bench/bench_start.log (e.g., use nohup or append `>
~/frappe-bench/bench_start.log 2>&1 &`), ensure the ~/frappe-bench directory
exists before writing, and keep the background start command (bench start)
otherwise unchanged so the CI step can cat the log.

63 changes: 36 additions & 27 deletions india_compliance/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,7 @@


def before_tests():
frappe.clear_cache()

if not frappe.db.a_row_exists("Company"):
today = getdate()
year = today.year if today.month > 3 else today.year - 1

setup_complete(
{
"currency": "INR",
"full_name": "Test User",
"company_name": "Wind Power LLP",
"timezone": "Asia/Kolkata",
"company_abbr": "WP",
"industry": "Manufacturing",
"country": "India",
"fy_start_date": f"{year}-04-01",
"fy_end_date": f"{year + 1}-03-31",
"language": "English",
"company_tagline": "Testing",
"email": "test@example.com",
"password": "test",
"chart_of_accounts": "Standard",
"company_gstin": "29MUMB22923F1D",
"default_gst_rate": "18.0",
"enable_audit_trail": 0,
}
)
setup_india_company()

set_default_settings_for_tests()
create_test_records()
Expand All @@ -47,6 +21,41 @@ def before_tests():
frappe.enqueue = partial(frappe.enqueue, now=True)


def setup_india_company():
frappe.clear_cache()

if not frappe.db.a_row_exists("Company"):
today = getdate()
year = today.year if today.month > 3 else today.year - 1

setup_args = {
"currency": "INR",
"full_name": "Test User",
"company_name": "Wind Power LLP",
"timezone": "Asia/Kolkata",
"company_abbr": "WP",
"industry": "Manufacturing",
"country": "India",
"fy_start_date": f"{year}-04-01",
"fy_end_date": f"{year + 1}-03-31",
"language": "English",
"company_tagline": "Testing",
"email": "test@example.com",
"password": "test",
"chart_of_accounts": "Standard",
"enable_audit_trail": 0,
"company_gstin": "29MUMB22923F1D",
"default_gst_rate": "18.0",
}

setup_complete(setup_args)

Comment on lines +24 to +52
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Count characters in the GSTIN
echo "GSTIN character count:"
echo -n "29MUMB22923F1D" | wc -c

# Find GSTIN_FORMAT regex in the codebase
echo ""
echo "Searching for GSTIN_FORMAT definition:"
rg -n "GSTIN_FORMAT" --type py -B2 -A2

# Find other company_gstin values in tests
echo ""
echo "Searching for other test GSTINs:"
rg -n "company_gstin" --type py -A1 | head -20

Repository: resilient-tech/india-compliance

Length of output: 5688


🏁 Script executed:

#!/bin/bash
# Find validate_gstin function implementation
echo "Finding validate_gstin implementation:"
rg -n "def validate_gstin" --type py -A20

# Also check the GSTIN_FORMATS patterns definition
echo ""
echo "Checking GSTIN_FORMATS patterns:"
rg -n "GSTIN_FORMATS\s*=" --type py -A10

Repository: resilient-tech/india-compliance

Length of output: 9918


🏁 Script executed:

#!/bin/bash
# Find setup_complete function
echo "Finding setup_complete function:"
rg -n "def setup_complete" --type py -A30

# Also check where setup_complete is imported from in tests/__init__.py
echo ""
echo "Checking imports in tests/__init__.py:"
head -30 india_compliance/tests/__init__.py

Repository: resilient-tech/india-compliance

Length of output: 939


🏁 Script executed:

#!/bin/bash
# Search for setup_wizard in india_compliance
echo "Searching for setup_wizard hooks or overrides in india_compliance:"
rg -n "setup_wizard\|setup_complete" india_compliance --type py -B2 -A2

# Check if validate_gstin is called during company creation
echo ""
echo "Searching for where validate_gstin is called:"
rg -n "validate_gstin\(" --type py | head -20

Repository: resilient-tech/india-compliance

Length of output: 989


🏁 Script executed:

#!/bin/bash
# Check the full setup_wizard.py to see how it integrates
echo "Reading india_compliance/setup_wizard.py:"
cat india_compliance/setup_wizard.py

Repository: resilient-tech/india-compliance

Length of output: 3675


Correct the test GSTIN to 15 characters.

The GSTIN 29MUMB22923F1D is 14 characters, but valid Indian GSTINs must be exactly 15 characters (format: 2 state code + 5 PAN letters + 4 PAN digits + 1 entity type + 1 digit/letter + 'Z' + 1 checksum). The validation function in setup_wizard.py will reject this GSTIN and set it to None, defeating the purpose of this test data.

🤖 Prompt for AI Agents
In @india_compliance/tests/__init__.py around lines 24 - 52, The test GSTIN in
setup_india_company is 14 chars and will be rejected; update
setup_args["company_gstin"] to a valid 15-character GSTIN (e.g., follow the
pattern used by the validation: 2-digit state code + 10-char PAN + entity code +
'Z' + checksum) so the value remains set during setup; locate the
setup_india_company function and change the "company_gstin" entry in the
setup_args dict to a correct 15-character GSTIN string.


def setup_post_install_test_data():
setup_india_company()
frappe.db.commit()


def set_default_settings_for_tests():
# e.g. set "All Customer Groups" as the default Customer Group
for key in ("Customer Group", "Supplier Group", "Item Group", "Territory"):
Expand Down