From 746998c552dfa75dc0796f0ed0496da02bacbf96 Mon Sep 17 00:00:00 2001 From: Tom Close Date: Wed, 23 Oct 2024 17:31:58 +1100 Subject: [PATCH] added hyphen to list of invalid id chars --- xnat_ingest/cli/stage.py | 6 +++--- xnat_ingest/tests/test_cli.py | 11 +++++++---- xnat_ingest/utils.py | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/xnat_ingest/cli/stage.py b/xnat_ingest/cli/stage.py index 08ee319..c54b6e1 100644 --- a/xnat_ingest/cli/stage.py +++ b/xnat_ingest/cli/stage.py @@ -36,8 +36,8 @@ are uploaded to XNAT """, ) -@click.argument("files_path", type=str, envvar="XINGEST_DICOMS_PATH") -@click.argument("output_dir", type=click.Path(path_type=Path), envvar="XINGEST_DIR") +@click.argument("files_path", type=str) +@click.argument("output_dir", type=click.Path(path_type=Path)) @click.option( "--datatype", type=str, @@ -193,7 +193,7 @@ default=None, metavar=" ", help="The XNAT server to upload to plus the user and password to use", - envvar="XNAT_INGEST_TRANSFER_XNAT_LOGIN", + envvar="XINGEST_XNAT_LOGIN", ) @click.option( "--spaces-to-underscores/--no-spaces-to-underscores", diff --git a/xnat_ingest/tests/test_cli.py b/xnat_ingest/tests/test_cli.py index 5d3cdc5..5c781d5 100644 --- a/xnat_ingest/tests/test_cli.py +++ b/xnat_ingest/tests/test_cli.py @@ -200,10 +200,10 @@ def test_stage_and_upload( str(associated_files_dir) + "/{PatientName.family_name}_{PatientName.given_name}*.ptd", r".*/[^\.]+.[^\.]+.[^\.]+.(?P\d+)\.[A-Z]+_(?P[^\.]+).*", - "--logger", - "file", - "info", - str(log_file), + # "--logger", + # "file", + # "info", + # str(log_file), "--additional-logger", "xnat", "--raise-errors", @@ -213,6 +213,9 @@ def test_stage_and_upload( "admin", "admin", ], + env={ + "XINGEST_LOGGERS": "file,info,/tmp/logging.log;stream,debug,stdout", + }, ) assert result.exit_code == 0, show_cli_trace(result) diff --git a/xnat_ingest/utils.py b/xnat_ingest/utils.py index 1b33e6e..b634b11 100644 --- a/xnat_ingest/utils.py +++ b/xnat_ingest/utils.py @@ -371,4 +371,4 @@ def glob_to_re(glob_pattern: str) -> str: _str_templ_replacement = re.compile(r"\{[\w\.]+\}") -invalid_path_chars_re = re.compile(r'[<>:"/\\|?*\x00-\x1F]') +invalid_path_chars_re = re.compile(r'[\-<>:"/\\|?*\x00-\x1F]')