Mercurial > hg > orthanc-tests
annotate NewTests/helpers.py @ 473:4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
author | Alain Mazy <am@osimis.io> |
---|---|
date | Sat, 30 Apr 2022 19:38:34 +0200 |
parents | |
children | 6917a26881ed |
rev | line source |
---|---|
473
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
1 import unittest |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
2 from orthanc_api_client import OrthancApiClient |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
3 import subprocess |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
4 import json |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
5 import time |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
6 import typing |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
7 import shutil |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
8 from threading import Thread |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
9 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
10 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
11 import pathlib |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
12 here = pathlib.Path(__file__).parent.resolve() |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
13 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
14 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
15 default_base_config = { |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
16 "AuthenticationEnabled": False, |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
17 "RemoteAccessAllowed": True |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
18 } |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
19 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
20 class Helpers: |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
21 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
22 orthanc_under_tests_hostname: str = 'localhost' |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
23 orthanc_under_tests_http_port: int = 8042 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
24 orthanc_under_tests_exe: str = None |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
25 orthanc_previous_version_exe: str = None |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
26 orthanc_under_tests_docker_image: str = None |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
27 skip_preparation: bool = False |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
28 break_after_preparation: bool = False |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
29 plugins: typing.List[str] = [] |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
30 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
31 @classmethod |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
32 def get_orthanc_url(cls): |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
33 return f"http://{cls.orthanc_under_tests_hostname}:{cls.orthanc_under_tests_http_port}" |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
34 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
35 class OrthancTestCase(unittest.TestCase): |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
36 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
37 o: OrthancApiClient = None # the orthanc under tests api client |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
38 _orthanc_process = None |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
39 _orthanc_is_running = False |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
40 _orthanc_logger_thread = None |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
41 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
42 @classmethod |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
43 def setUpClass(cls): |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
44 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
45 cls.o = OrthancApiClient(Helpers.get_orthanc_url()) |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
46 cls._prepare() |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
47 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
48 @classmethod |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
49 def tearDownClass(cls): |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
50 if not Helpers.break_after_preparation: |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
51 cls.kill_orthanc() |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
52 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
53 @classmethod |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
54 def prepare(cls): |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
55 pass # to override |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
56 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
57 @classmethod |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
58 def _prepare(cls): |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
59 if not Helpers.skip_preparation: |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
60 cls.prepare() |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
61 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
62 @classmethod |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
63 def get_storage_path(cls, storage_name: str): |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
64 return str(here / "storages" / f"{storage_name}") |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
65 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
66 @classmethod |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
67 def generate_configuration(cls, config_name: str, config: object, storage_name: str, plugins = []): |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
68 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
69 # add plugins and default storge directory |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
70 config["Plugins"] = plugins |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
71 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
72 if not "StorageDirectory" in config: |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
73 config["StorageDirectory"] = cls.get_storage_path(storage_name=storage_name) |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
74 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
75 if not "Name" in config: |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
76 config["Name"] = config_name |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
77 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
78 if not "HttpPort" in config: |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
79 config["HttpPort"] = Helpers.orthanc_under_tests_http_port |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
80 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
81 # copy the values from the base config |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
82 for k, v in default_base_config.items(): |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
83 if not k in config: |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
84 config[k] = v |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
85 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
86 # save to disk |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
87 path = str(here / "configurations" / f"{config_name}.json") |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
88 with open(path, "w") as f: |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
89 json.dump(config, f, indent=4) |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
90 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
91 return path |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
92 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
93 @classmethod |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
94 def clear_storage(cls, storage_name: str): |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
95 storage_path = cls.get_storage_path(storage_name=storage_name) |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
96 shutil.rmtree(storage_path) |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
97 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
98 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
99 @classmethod |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
100 def launch_orthanc_to_prepare_db(cls, config_name: str, config: object, storage_name: str, plugins = []): |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
101 # generate the configuration file |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
102 config_path = cls.generate_configuration( |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
103 config_name=config_name, |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
104 storage_name=storage_name, |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
105 config=config, |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
106 plugins=plugins |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
107 ) |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
108 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
109 # run orthanc |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
110 if Helpers.orthanc_previous_version_exe: |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
111 cls.launch_orthanc( |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
112 exe_path=Helpers.orthanc_previous_version_exe, |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
113 config_path=config_path |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
114 ) |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
115 else: |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
116 raise RuntimeError("No orthanc_previous_version_exe defined, can not launch Orthanc") |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
117 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
118 @classmethod |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
119 def launch_orthanc(cls, exe_path: str, config_path: str): |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
120 cls._orthanc_process = subprocess.Popen( |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
121 [exe_path, "--verbose", config_path], |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
122 stdout=subprocess.PIPE, |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
123 stderr=subprocess.PIPE |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
124 ) |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
125 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
126 cls.o.wait_started(10) |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
127 if not cls.o.is_alive(): |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
128 output = cls.get_orthanc_process_output() |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
129 print("Orthanc output\n" + output) |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
130 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
131 raise RuntimeError(f"Orthanc failed to start '{exe_path}', conf = '{config_path}'. Check output above") |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
132 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
133 @classmethod |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
134 def kill_orthanc(cls): |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
135 cls._orthanc_process.kill() |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
136 output = cls.get_orthanc_process_output() |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
137 print("Orthanc output\n" + output) |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
138 cls._orthanc_process = None |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
139 |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
140 @classmethod |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
141 def get_orthanc_process_output(cls): |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
142 outputs = cls._orthanc_process.communicate() |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
143 output = "" |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
144 for o in outputs: |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
145 output += o.decode('utf-8') |
4ee85b016a40
added NewTests framework - only the Housekeeper tests right now
Alain Mazy <am@osimis.io>
parents:
diff
changeset
|
146 return output |