From fcd16eb8bcaf6223416168f717b58f4e8499e529 Mon Sep 17 00:00:00 2001 From: JoschD <26184899+JoschD@users.noreply.github.com> Date: Thu, 30 Nov 2023 16:47:50 +0100 Subject: [PATCH] fix and test --- CHANGELOG.md | 6 +++++- pylhc_submitter/__init__.py | 2 +- pylhc_submitter/job_submitter.py | 2 +- tests/unit/test_job_submitter.py | 24 +++++++++++++++--------- 4 files changed, 22 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f37e42..f37dac3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,12 @@ # `pylhc-submitter` Changelog +## Version 2.0.2 + +- Fixing `job_submitter`: Discovers more invalid URIs. + ## Version 2.0.1 -- Fixing job_submitter: type error in `print_stats`, when job-names are integers. +- Fixing `job_submitter`: type error in `print_stats`, when job-names are integers. ## Version 2.0.0 diff --git a/pylhc_submitter/__init__.py b/pylhc_submitter/__init__.py index 2a1fbe1..03feeaf 100644 --- a/pylhc_submitter/__init__.py +++ b/pylhc_submitter/__init__.py @@ -10,7 +10,7 @@ __title__ = "pylhc_submitter" __description__ = "pylhc-submitter contains scripts to simplify the creation and submission of jobs to HTCondor at CERN" __url__ = "https://github.com/pylhc/submitter" -__version__ = "2.0.1" +__version__ = "2.0.2" __author__ = "pylhc" __author_email__ = "pylhc@github.com" __license__ = "MIT" diff --git a/pylhc_submitter/job_submitter.py b/pylhc_submitter/job_submitter.py index 6efe9b8..5ef5860 100644 --- a/pylhc_submitter/job_submitter.py +++ b/pylhc_submitter/job_submitter.py @@ -356,7 +356,7 @@ def check_opts(opt): else: mask_content = opt.mask - if is_eos_uri(opt.output_destination) and not ("://" in opt.output_destination and "//eos" in opt.output_destination): + if is_eos_uri(opt.output_destination) and not ("://" in opt.output_destination and "//eos/" in opt.output_destination): raise ValueError( "The 'output_destination' is an EOS-URI but missing '://' or '//eos' (double slashes?). " ) diff --git a/tests/unit/test_job_submitter.py b/tests/unit/test_job_submitter.py index 09e330b..57eefa3 100644 --- a/tests/unit/test_job_submitter.py +++ b/tests/unit/test_job_submitter.py @@ -46,15 +46,21 @@ def test_output_directory(tmp_path): def test_detects_wrong_uri(tmp_path): """ Tests that wrong URI's are identified. """ - setup = InputParameters( - working_directory=tmp_path, - run_local=True, - output_destination="root:/eosuser.cern.ch/eos/my_new_output", - ) - setup.create_mask() - with pytest.raises(ValueError) as e: - job_submit(**asdict(setup)) - assert "EOS-URI" in str(e) + for test_uri in [ + "root:/eosuser.cern.ch//eos/my_new_output/", + "root://eosuser.cern.ch/eos/my_new_output/", + "root:/eosuser.cern.ch/eos/my_new_output/", + ]: + setup = InputParameters( + working_directory=tmp_path, + run_local=True, + output_destination=test_uri, + ) + setup.create_mask() + with pytest.raises(ValueError) as e: + job_submit(**asdict(setup)) + assert "EOS-URI" in str(e) + @run_only_on_linux