2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-16 01:57:08 +00:00

ci: Update conditions for FRAPPE_BRANCH

This commit is contained in:
Gavin D'souza 2022-07-27 16:16:54 +05:30
parent e66fe9ca02
commit 1badfa8da4
5 changed files with 13 additions and 22 deletions

View File

@ -5,11 +5,6 @@ sudo: true
git:
depth: 1
cache:
- pip
- npm
- yarn
addons:
mariadb: '10.3'
@ -61,20 +56,18 @@ matrix:
script: python -m unittest -v bench.tests.test_utils && python -m unittest -v bench.tests.test_init
install:
- pip3 install urllib3 pyOpenSSL ndg-httpsclient pyasn1
- python -m pip install urllib3 pyOpenSSL ndg-httpsclient pyasn1
- if [ $TEST == "bench" ];then
wget -q -O /tmp/wkhtmltox.tar.xz https://github.com/frappe/wkhtmltopdf/raw/master/wkhtmltox-0.12.3_linux-generic-amd64.tar.xz;
tar -xf /tmp/wkhtmltox.tar.xz -C /tmp;
sudo mv /tmp/wkhtmltox/bin/wkhtmltopdf /usr/local/bin/wkhtmltopdf;
sudo chmod o+x /usr/local/bin/wkhtmltopdf;
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb;
sudo apt install ./wkhtmltox_0.12.6-1.focal_amd64.deb;
nvm install 14;
nvm use 14;
mkdir -p ~/.bench;
cp -r $TRAVIS_BUILD_DIR/* ~/.bench;
pip3 install -q -U -e ~/.bench;
python -m pip install -U -e ~/.bench;
mysql -u root -e "SET GLOBAL character_set_server = 'utf8mb4'";
mysql -u root -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'";

View File

@ -17,10 +17,10 @@ PYTHON_VER = sys.version_info
FRAPPE_BRANCH = "version-12"
if PYTHON_VER.major == 3:
if PYTHON_VER.minor in [6, 7]:
FRAPPE_BRANCH = "version-13"
else:
if PYTHON_VER.minor >= 10:
FRAPPE_BRANCH = "develop"
if 7 >= PYTHON_VER.minor >= 9:
FRAPPE_BRANCH = "version-13"
class TestBenchBase(unittest.TestCase):
@ -134,5 +134,4 @@ class TestBenchBase(unittest.TestCase):
def get_traceback(self):
exc_type, exc_value, exc_tb = sys.exc_info()
trace_list = traceback.format_exception(exc_type, exc_value, exc_tb)
body = "".join(str(t) for t in trace_list)
return body
return "".join(str(t) for t in trace_list)

View File

@ -184,15 +184,15 @@ class TestBenchInit(TestBenchBase):
successful_switch = not exec_cmd(
f"bench switch-to-branch {prevoius_branch} frappe --upgrade", cwd=bench_path
)
app_branch_after_switch = str(git.Repo(path=app_path).active_branch)
if successful_switch:
app_branch_after_switch = str(git.Repo(path=app_path).active_branch)
self.assertEqual(prevoius_branch, app_branch_after_switch)
successful_switch = not exec_cmd(
f"bench switch-to-branch {FRAPPE_BRANCH} frappe --upgrade", cwd=bench_path
)
app_branch_after_second_switch = str(git.Repo(path=app_path).active_branch)
if successful_switch:
app_branch_after_second_switch = str(git.Repo(path=app_path).active_branch)
self.assertEqual(FRAPPE_BRANCH, app_branch_after_second_switch)

View File

@ -1,6 +1,7 @@
# imports - standard imports
import getpass
import os
import pathlib
import re
import subprocess
import time
@ -76,9 +77,7 @@ class TestSetupProduction(TestBenchBase):
if os.environ.get("CI"):
sudoers = subprocess.check_output(["sudo", "cat", sudoers_file]).decode("utf-8")
else:
with open(sudoers_file) as f:
sudoers = f.read()
sudoers = pathlib.Path(sudoers_file).read_text()
self.assertTrue(f"{user} ALL = (root) NOPASSWD: {service} nginx *" in sudoers)
self.assertTrue(f"{user} ALL = (root) NOPASSWD: {nginx}" in sudoers)

View File

@ -5,5 +5,5 @@ Jinja2~=3.0.3
python-crontab~=2.4.0
requests
semantic-version~=2.8.2
setuptools
setuptools>60.0.0
tomli;python_version<"3.11"