Skip to content

Commit

Permalink
Fix broken rebase, and a few minor stuffs
Browse files Browse the repository at this point in the history
  • Loading branch information
dbutenhof committed Oct 16, 2023
1 parent 447c74b commit 5f485ff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
9 changes: 5 additions & 4 deletions lib/pbench/test/unit/server/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat
from flask.wrappers import Response
from freezegun import freeze_time
import jwt
import pytest
from requests import Response
import responses

from pbench.common import MetadataLog
Expand Down Expand Up @@ -226,9 +226,10 @@ def compare(message: str, response: Optional[Response]):
if r.levelno == logging.ERROR:
if internal.match(str(r.msg)):
return
assert (
False
), f"Expected pattern {internal.pattern!r} not logged at level 'ERROR': {[str(r.msg) for r in caplog.get_records('call')]}"
assert False, (
f"Expected pattern {internal.pattern!r} not logged "
f"at level 'ERROR': {[str(r.msg) for r in caplog.get_records('call')]}"
)

return compare

Expand Down
2 changes: 1 addition & 1 deletion lib/pbench/test/unit/server/test_cache_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ def generate_test_result_tree(tmp_path: Path, dir_name: str) -> Path:
sub_dir / "subdir1" / "subdir14" / "subdir141" / "f1413_sym",
)
os.symlink(
Path(".") / "f1411.txt",
Path("./f1411.txt"),
sub_dir / "subdir1" / "subdir14" / "subdir141" / "f1414_sym",
)
os.symlink(
Expand Down
9 changes: 2 additions & 7 deletions lib/pbench/test/unit/server/test_datasets_contents.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,19 @@ def test_unauthorized_access(self, query_get_as):
@pytest.mark.parametrize("key", ("", ".", "subdir1"))
def test_path_is_directory(self, query_get_as, monkeypatch, key):
"""Mock a directory cache node to check the returned data"""
name = "" if key == "." else key

def mock_find_entry(_s, _d: str, path: Optional[Path]):
file = path if path else Path(".")
return {
"children": {},
"details": CacheObject(
"" if key == "." else key,
file,
None,
None,
None,
CacheType.DIRECTORY,
name, file, None, None, None, CacheType.DIRECTORY
),
}

monkeypatch.setattr(CacheManager, "find_entry", mock_find_entry)
response = query_get_as("fio_2", key, HTTPStatus.OK)
name = "" if key == "." else key
assert response.json == {
"directories": [],
"files": [],
Expand Down

0 comments on commit 5f485ff

Please sign in to comment.