Mercurial > hg > orthanc-tests
comparison NewTests/main.py @ 474:6917a26881ed
NewTests working with Docker
author | Alain Mazy <am@osimis.io> |
---|---|
date | Mon, 02 May 2022 17:05:42 +0200 |
parents | 4ee85b016a40 |
children | fe37cf5e9c02 |
comparison
equal
deleted
inserted
replaced
473:4ee85b016a40 | 474:6917a26881ed |
---|---|
3 import os | 3 import os |
4 import sys | 4 import sys |
5 import argparse | 5 import argparse |
6 from helpers import Helpers | 6 from helpers import Helpers |
7 import pathlib | 7 import pathlib |
8 # python3 main.py --orthanc_under_tests_exe=/home/alain/o/build/orthanc/Orthanc --pattern=Housekeeper.test_housekeeper.TestHousekeeper.*test_is* --plugin=/home/alain/o/build/orthanc/libHousekeeper.so | 8 # python3 main.py --orthanc_under_tests_exe=/home/alain/o/build/orthanc/Orthanc --pattern=Housekeeper.test_housekeeper.TestHousekeeper.* --plugin=/home/alain/o/build/orthanc/libHousekeeper.so |
9 | 9 |
10 here = pathlib.Path(__file__).parent.resolve() | 10 here = pathlib.Path(__file__).parent.resolve() |
11 | 11 |
12 | 12 |
13 def load_tests(loader=None, tests=None, pattern='test_*.py'): | 13 def load_tests(loader=None, tests=None, pattern='test_*.py'): |
21 parser.add_argument('-k', '--pattern', dest='test_name_patterns', action='append', type=str, help='a test pattern (ex: Housekeeper.toto') | 21 parser.add_argument('-k', '--pattern', dest='test_name_patterns', action='append', type=str, help='a test pattern (ex: Housekeeper.toto') |
22 parser.add_argument('--orthanc_under_tests_hostname', type=str, default="localhost", help="orthanc under tests hostname") | 22 parser.add_argument('--orthanc_under_tests_hostname', type=str, default="localhost", help="orthanc under tests hostname") |
23 parser.add_argument('--orthanc_under_tests_http_port', type=int, default=8042, help="orthanc under tests HTTP port") | 23 parser.add_argument('--orthanc_under_tests_http_port', type=int, default=8042, help="orthanc under tests HTTP port") |
24 parser.add_argument('--orthanc_under_tests_exe', type=str, default=None, help="path to the orthanc executable (if it must be launched by this script)") | 24 parser.add_argument('--orthanc_under_tests_exe', type=str, default=None, help="path to the orthanc executable (if it must be launched by this script)") |
25 parser.add_argument('--orthanc_previous_version_exe', type=str, default=None, help="path to the orthanc executable used to prepare previous version of storage/db (if it must be launched by this script and if different from orthanc_under_tests_exe)") | 25 parser.add_argument('--orthanc_previous_version_exe', type=str, default=None, help="path to the orthanc executable used to prepare previous version of storage/db (if it must be launched by this script and if different from orthanc_under_tests_exe)") |
26 parser.add_argument('--orthanc_under_tests_docker_image', type=str, default=None, help="tag of the Docker image of the orthanc under tests (if it must be launched by this script)") | 26 parser.add_argument('--orthanc_under_tests_docker_image', type=str, default=None, help="Docker image of the orthanc under tests (if it must be launched by this script)") |
27 parser.add_argument('--orthanc_previous_version_docker_image', type=str, default=None, help="Docker image of the orthanc version used to prepare previous version of storage/db (if it must be launched by this script)") | |
27 parser.add_argument('--skip_preparation', action='store_true', help="if this is a multi stage tests with preparations, skip the preparation") | 28 parser.add_argument('--skip_preparation', action='store_true', help="if this is a multi stage tests with preparations, skip the preparation") |
28 parser.add_argument('--break_after_preparation', action='store_true', help="if this is a multi stage tests with preparations, pause after the preparation (such that you can start your own orthanc-under-tests in your debugger)") | 29 parser.add_argument('--break_after_preparation', action='store_true', help="if this is a multi stage tests with preparations, pause after the preparation (such that you can start your own orthanc-under-tests in your debugger)") |
29 parser.add_argument('-p', '--plugin', dest='plugins', action='append', type=str, help='path to a plugin to add to configuration') | 30 parser.add_argument('-p', '--plugin', dest='plugins', action='append', type=str, help='path to a plugin to add to configuration') |
30 | 31 |
31 | 32 |
34 loader = unittest.TestLoader() | 35 loader = unittest.TestLoader() |
35 loader.testNamePatterns = args.test_name_patterns | 36 loader.testNamePatterns = args.test_name_patterns |
36 | 37 |
37 Helpers.orthanc_under_tests_hostname = args.orthanc_under_tests_hostname | 38 Helpers.orthanc_under_tests_hostname = args.orthanc_under_tests_hostname |
38 Helpers.orthanc_under_tests_http_port = args.orthanc_under_tests_http_port | 39 Helpers.orthanc_under_tests_http_port = args.orthanc_under_tests_http_port |
40 Helpers.plugins = args.plugins | |
41 | |
39 Helpers.orthanc_under_tests_exe = args.orthanc_under_tests_exe | 42 Helpers.orthanc_under_tests_exe = args.orthanc_under_tests_exe |
40 Helpers.plugins = args.plugins | 43 Helpers.orthanc_under_tests_docker_image = args.orthanc_under_tests_docker_image |
44 | |
41 if args.orthanc_previous_version_exe: | 45 if args.orthanc_previous_version_exe: |
42 Helpers.orthanc_previous_version_exe = args.orthanc_previous_version_exe | 46 Helpers.orthanc_previous_version_exe = args.orthanc_previous_version_exe |
43 else: | 47 else: |
44 Helpers.orthanc_previous_version_exe = args.orthanc_under_tests_exe | 48 Helpers.orthanc_previous_version_exe = args.orthanc_under_tests_exe |
45 | 49 |
46 Helpers.orthanc_under_tests_docker_image = args.orthanc_under_tests_docker_image | 50 if args.orthanc_previous_version_docker_image: |
51 Helpers.orthanc_previous_version_docker_image = args.orthanc_previous_version_docker_image | |
52 else: | |
53 Helpers.orthanc_previous_version_docker_image = args.orthanc_under_tests_docker_image | |
54 | |
47 if args.skip_preparation: | 55 if args.skip_preparation: |
48 Helpers.skip_preparation = True | 56 Helpers.skip_preparation = True |
49 if args.break_after_preparation: | 57 if args.break_after_preparation: |
50 Helpers.break_after_preparation = True | 58 Helpers.break_after_preparation = True |
51 | 59 |