Skip to content

Commit

Permalink
fix and test
Browse files Browse the repository at this point in the history
  • Loading branch information
JoschD committed Nov 30, 2023
1 parent 0cc8b91 commit 40dc35c
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion pylhc_submitter/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__ = "[email protected]"
__license__ = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion pylhc_submitter/job_submitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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?). "
)
Expand Down
24 changes: 15 additions & 9 deletions tests/unit/test_job_submitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 40dc35c

Please sign in to comment.