2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-12 00:06:36 +00:00

Merge pull request #1036 from gavindsouza/test-traceback

travis: Separate builds for setup, install script and tests
This commit is contained in:
gavin 2020-08-05 15:01:26 +05:30 committed by GitHub
commit 3332051dae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 46 additions and 16 deletions

View File

@ -18,42 +18,52 @@ matrix:
- name: "Python 2.7 Basic Setup"
python: 2.7
env: TEST=bench
script: python -m unittest -v bench.tests.test_init
script: python bench/tests/test_init.py TestBenchInit.basic
- name: "Python 3.6 Basic Setup"
python: 3.6
env: TEST=bench
script: python -m unittest -v bench.tests.test_init
script: python bench/tests/test_init.py TestBenchInit.basic
- name: "Python 3.7 Basic Setup"
python: 3.7
env: TEST=bench
script: python -m unittest -v bench.tests.test_init
script: python bench/tests/test_init.py TestBenchInit.basic
- name: "Python 3.8 Production Setup"
python: 3.8
env: TEST=bench
script: python -m unittest -v bench.tests.test_setup_production
script: python bench/tests/test_setup_production.py TestSetupProduction.production
- name: "Python 2.7 Production Setup"
python: 2.7
env: TEST=bench
script: python -m unittest -v bench.tests.test_setup_production
script: python bench/tests/test_setup_production.py TestSetupProduction.production
- name: "Python 3.6 Production Setup"
python: 3.6
env: TEST=bench
script: python -m unittest -v bench.tests.test_setup_production
script: python bench/tests/test_setup_production.py TestSetupProduction.production
- name: "Python 3.7 Production Setup"
python: 3.7
env: TEST=bench
script: python -m unittest -v bench.tests.test_setup_production
script: python bench/tests/test_setup_production.py TestSetupProduction.production
- name: "Python 3.8 Production Setup"
python: 3.8
env: TEST=bench
script: python -m unittest -v bench.tests.test_setup_production
script: python bench/tests/test_setup_production.py TestSetupProduction.production
- name: "Python 2.7 Tests"
python: 2.7
env: TEST=bench
script: python -m unittest -v bench.tests.test_init
- name: "Python 3.7 Tests"
python: 3.7
env: TEST=bench
script: python -m unittest -v bench.tests.test_init
- name: "Python 3.6 Easy Install"
python: 3.6

View File

@ -1,19 +1,19 @@
# imports - standard imports
import getpass
import json
import os
import shutil
import subprocess
import sys
import traceback
import unittest
import getpass
# imports - module imports
import bench
import bench.utils
# imports - third party imports
from six import PY2
# imports - module imports
import bench
import bench.utils
if PY2:
FRAPPE_BRANCH = "version-12"
@ -102,3 +102,9 @@ class TestBenchBase(unittest.TestCase):
if os.environ.get("CI"):
return not subprocess.call(["sudo", "test", "-f", path])
return os.path.isfile(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

View File

@ -11,7 +11,7 @@ import git
import bench
import bench.utils
from bench.release import get_bumped_version
from bench.tests.test_base import TestBenchBase, FRAPPE_BRANCH
from bench.tests.test_base import FRAPPE_BRANCH, TestBenchBase
class TestBenchInit(TestBenchBase):
@ -34,6 +34,13 @@ class TestBenchInit(TestBenchBase):
self.assert_config(bench_name)
def basic(self):
try:
self.test_init()
except Exception:
print(self.get_traceback())
def test_multiple_benches(self):
for bench_name in ("test-bench-1", "test-bench-2"):
self.init_bench(bench_name)
@ -148,4 +155,4 @@ class TestBenchInit(TestBenchBase):
if __name__ == '__main__':
unittest.main()
unittest.main()

View File

@ -33,6 +33,13 @@ class TestSetupProduction(TestBenchBase):
bench.utils.exec_cmd("sudo bench disable-production", cwd=bench_path)
def production(self):
try:
self.test_setup_production()
except Exception:
print(self.get_traceback())
def assert_nginx_config(self, bench_name):
conf_src = os.path.join(os.path.abspath(self.benches_path), bench_name, 'config', 'nginx.conf')
conf_dest = "/etc/nginx/conf.d/{bench_name}.conf".format(bench_name=bench_name)
@ -169,4 +176,4 @@ class TestSetupProduction(TestBenchBase):
if __name__ == '__main__':
unittest.main()
unittest.main()