Skip to content

Commit

Permalink
ci: Update conditions for FRAPPE_BRANCH
Browse files Browse the repository at this point in the history
  • Loading branch information
gavindsouza committed Jul 27, 2022
1 parent e66fe9c commit 1badfa8
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 22 deletions.
15 changes: 4 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ sudo: true
git:
depth: 1

cache:
- pip
- npm
- yarn

addons:
mariadb: '10.3'

Expand Down Expand Up @@ -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'";
Expand Down
9 changes: 4 additions & 5 deletions bench/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@

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):
Expand Down Expand Up @@ -134,5 +134,4 @@ def file_exists(self, path):
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)
4 changes: 2 additions & 2 deletions bench/tests/test_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,15 +184,15 @@ def test_switch_to_branch(self):
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)


Expand Down
5 changes: 2 additions & 3 deletions bench/tests/test_setup_production.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# imports - standard imports
import getpass
import os
import pathlib
import re
import subprocess
import time
Expand Down Expand Up @@ -76,9 +77,7 @@ def assert_sudoers(self, user):
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)

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 1badfa8

Please sign in to comment.