Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
diegoferigo committed Feb 28, 2024
1 parent abbdb50 commit fd3ca7d
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions test/test_resolve_robotics_uri_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,28 +125,24 @@ def test_scheme_file():

clear_env_vars()

# Non-existing relative URI path
with pytest.raises(FileNotFoundError):
uri_file = "file://this/file/does/not.exist"
resolve_robotics_uri_py.resolve_robotics_uri(uri_file)

# Non-existing absolute URI path
with pytest.raises(FileNotFoundError):
uri_file = "file:///this/file/does/not.exist"
uri_file = "file://" + "/this/file/does/not.exist"
resolve_robotics_uri_py.resolve_robotics_uri(uri_file)

# Existing absolute URI path
# Existing absolute URI path with empty authority
with tempfile.NamedTemporaryFile() as temp:
temp_name = pathlib.Path(temp.name).resolve(strict=True)
uri_file = f"file://{temp.name}"
uri_file = "file://" + temp.name
path_of_file = resolve_robotics_uri_py.resolve_robotics_uri(uri_file)
assert path_of_file == path_of_file.resolve()
assert path_of_file == temp_name

# Existing relative URI path (automatic conversion to absolute)
# Existing absolute URI path without authority
with tempfile.NamedTemporaryFile() as temp:
temp_name = pathlib.Path(temp.name).resolve(strict=True)
uri_file = f"file:/{temp.name}"
uri_file = "file:" + temp.name
print("uri_file", uri_file)
path_of_file = resolve_robotics_uri_py.resolve_robotics_uri(uri_file)
assert path_of_file == path_of_file.resolve()
assert path_of_file == temp_name
Expand Down

0 comments on commit fd3ca7d

Please sign in to comment.