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:
commit
3332051dae
26
.travis.yml
26
.travis.yml
@ -18,42 +18,52 @@ matrix:
|
|||||||
- name: "Python 2.7 Basic Setup"
|
- name: "Python 2.7 Basic Setup"
|
||||||
python: 2.7
|
python: 2.7
|
||||||
env: TEST=bench
|
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"
|
- name: "Python 3.6 Basic Setup"
|
||||||
python: 3.6
|
python: 3.6
|
||||||
env: TEST=bench
|
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"
|
- name: "Python 3.7 Basic Setup"
|
||||||
python: 3.7
|
python: 3.7
|
||||||
env: TEST=bench
|
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"
|
- name: "Python 3.8 Production Setup"
|
||||||
python: 3.8
|
python: 3.8
|
||||||
env: TEST=bench
|
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"
|
- name: "Python 2.7 Production Setup"
|
||||||
python: 2.7
|
python: 2.7
|
||||||
env: TEST=bench
|
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"
|
- name: "Python 3.6 Production Setup"
|
||||||
python: 3.6
|
python: 3.6
|
||||||
env: TEST=bench
|
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"
|
- name: "Python 3.7 Production Setup"
|
||||||
python: 3.7
|
python: 3.7
|
||||||
env: TEST=bench
|
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"
|
- name: "Python 3.8 Production Setup"
|
||||||
python: 3.8
|
python: 3.8
|
||||||
env: TEST=bench
|
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"
|
- name: "Python 3.6 Easy Install"
|
||||||
python: 3.6
|
python: 3.6
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
# imports - standard imports
|
# imports - standard imports
|
||||||
|
import getpass
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
import traceback
|
||||||
import unittest
|
import unittest
|
||||||
import getpass
|
|
||||||
|
|
||||||
# imports - module imports
|
|
||||||
import bench
|
|
||||||
import bench.utils
|
|
||||||
|
|
||||||
# imports - third party imports
|
# imports - third party imports
|
||||||
from six import PY2
|
from six import PY2
|
||||||
|
|
||||||
|
# imports - module imports
|
||||||
|
import bench
|
||||||
|
import bench.utils
|
||||||
|
|
||||||
if PY2:
|
if PY2:
|
||||||
FRAPPE_BRANCH = "version-12"
|
FRAPPE_BRANCH = "version-12"
|
||||||
@ -102,3 +102,9 @@ class TestBenchBase(unittest.TestCase):
|
|||||||
if os.environ.get("CI"):
|
if os.environ.get("CI"):
|
||||||
return not subprocess.call(["sudo", "test", "-f", path])
|
return not subprocess.call(["sudo", "test", "-f", path])
|
||||||
return os.path.isfile(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
|
||||||
|
@ -11,7 +11,7 @@ import git
|
|||||||
import bench
|
import bench
|
||||||
import bench.utils
|
import bench.utils
|
||||||
from bench.release import get_bumped_version
|
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):
|
class TestBenchInit(TestBenchBase):
|
||||||
@ -34,6 +34,13 @@ class TestBenchInit(TestBenchBase):
|
|||||||
self.assert_config(bench_name)
|
self.assert_config(bench_name)
|
||||||
|
|
||||||
|
|
||||||
|
def basic(self):
|
||||||
|
try:
|
||||||
|
self.test_init()
|
||||||
|
except Exception:
|
||||||
|
print(self.get_traceback())
|
||||||
|
|
||||||
|
|
||||||
def test_multiple_benches(self):
|
def test_multiple_benches(self):
|
||||||
for bench_name in ("test-bench-1", "test-bench-2"):
|
for bench_name in ("test-bench-1", "test-bench-2"):
|
||||||
self.init_bench(bench_name)
|
self.init_bench(bench_name)
|
||||||
|
@ -33,6 +33,13 @@ class TestSetupProduction(TestBenchBase):
|
|||||||
bench.utils.exec_cmd("sudo bench disable-production", cwd=bench_path)
|
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):
|
def assert_nginx_config(self, bench_name):
|
||||||
conf_src = os.path.join(os.path.abspath(self.benches_path), bench_name, 'config', 'nginx.conf')
|
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)
|
conf_dest = "/etc/nginx/conf.d/{bench_name}.conf".format(bench_name=bench_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user