cleanup
This commit is contained in:
@@ -27,9 +27,6 @@ del os, sys, path
|
|||||||
# --------
|
# --------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import shutil
|
import shutil
|
||||||
@@ -41,6 +38,7 @@ TEMP_SERVER = "/tmp/bam_test_server"
|
|||||||
PORT = 5555
|
PORT = 5555
|
||||||
PROJECT_NAME = "test_project"
|
PROJECT_NAME = "test_project"
|
||||||
|
|
||||||
|
|
||||||
def run(cmd, cwd=None):
|
def run(cmd, cwd=None):
|
||||||
# print(">>> ", " ".join(cmd))
|
# print(">>> ", " ".join(cmd))
|
||||||
import subprocess
|
import subprocess
|
||||||
@@ -62,6 +60,7 @@ class CHDir:
|
|||||||
"dir_old",
|
"dir_old",
|
||||||
"dir_new",
|
"dir_new",
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self, directory):
|
def __init__(self, directory):
|
||||||
self.dir_old = os.getcwd()
|
self.dir_old = os.getcwd()
|
||||||
self.dir_new = directory
|
self.dir_new = directory
|
||||||
@@ -78,6 +77,7 @@ class StdIO:
|
|||||||
"stdout",
|
"stdout",
|
||||||
"stderr",
|
"stderr",
|
||||||
)
|
)
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.stdout = sys.stdout
|
self.stdout = sys.stdout
|
||||||
self.stderr = sys.stderr
|
self.stderr = sys.stderr
|
||||||
@@ -101,15 +101,18 @@ class StdIO:
|
|||||||
def svn_repo_create(id_, dirname):
|
def svn_repo_create(id_, dirname):
|
||||||
run(["svnadmin", "create", id_], cwd=dirname)
|
run(["svnadmin", "create", id_], cwd=dirname)
|
||||||
|
|
||||||
|
|
||||||
def svn_repo_checkout(path):
|
def svn_repo_checkout(path):
|
||||||
run(["svn", "checkout", path])
|
run(["svn", "checkout", path])
|
||||||
|
|
||||||
|
|
||||||
def svn_repo_populate(path):
|
def svn_repo_populate(path):
|
||||||
dummy_file = os.path.join(path, "file1")
|
dummy_file = os.path.join(path, "file1")
|
||||||
run(["touch", dummy_file])
|
run(["touch", dummy_file])
|
||||||
run(["svn", "add", dummy_file])
|
run(["svn", "add", dummy_file])
|
||||||
run(["svn", "commit", "-m", "First commit"])
|
run(["svn", "commit", "-m", "First commit"])
|
||||||
|
|
||||||
|
|
||||||
def bam_run(argv, cwd=None):
|
def bam_run(argv, cwd=None):
|
||||||
|
|
||||||
with CHDir(cwd):
|
with CHDir(cwd):
|
||||||
@@ -132,7 +135,6 @@ def server(mode='testing', debug=False):
|
|||||||
"""Start development server via Flask app.run() in a separate thread. We need server
|
"""Start development server via Flask app.run() in a separate thread. We need server
|
||||||
to run in order to check most of the client commands.
|
to run in order to check most of the client commands.
|
||||||
"""
|
"""
|
||||||
import threading
|
|
||||||
|
|
||||||
def run_testing_server():
|
def run_testing_server():
|
||||||
from application import app
|
from application import app
|
||||||
@@ -140,7 +142,7 @@ def server(mode='testing', debug=False):
|
|||||||
# with a testing, disposable one (create TMP dir)
|
# with a testing, disposable one (create TMP dir)
|
||||||
if mode == 'testing':
|
if mode == 'testing':
|
||||||
from application import db
|
from application import db
|
||||||
from application.modules.projects.model import Project, ProjectSetting
|
from application.modules.projects.model import Project
|
||||||
# Override sqlite database
|
# Override sqlite database
|
||||||
if not os.path.isdir(TEMP_SERVER):
|
if not os.path.isdir(TEMP_SERVER):
|
||||||
os.makedirs(TEMP_SERVER)
|
os.makedirs(TEMP_SERVER)
|
||||||
@@ -279,4 +281,3 @@ if __name__ == '__main__':
|
|||||||
p.terminate()
|
p.terminate()
|
||||||
|
|
||||||
shutil.rmtree(TEMP_SERVER, ignore_errors=True)
|
shutil.rmtree(TEMP_SERVER, ignore_errors=True)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user