Skip to content

Commit

Permalink
move logic to hyperion, change comments
Browse files Browse the repository at this point in the history
  • Loading branch information
olliesilvester committed May 13, 2024
1 parent 0ab3721 commit ce03053
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
13 changes: 3 additions & 10 deletions src/dodal/common/udc_directory_provider.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
from pathlib import Path

from ophyd_async.core import DirectoryInfo
Expand All @@ -8,8 +7,8 @@


class PandASubdirectoryProvider(UpdatingDirectoryProvider):
"""Directory provider for the HDFPanda. Points to, and optionally creates, a panda subdirectory relative to the
directory path provided"""
"""Directory provider for the HDFPanda. Points to a panda subdirectory within the
directory path provided, which must exist before attempting to arm the PCAP block"""

resource_dir = Path("panda")

Expand All @@ -24,13 +23,7 @@ def __init__(self, directory: Path | None = None):
else None
)

def update(self, directory: Path, create_directory=False):
if create_directory:
panda_directory = f"{directory}/{self.resource_dir}"
# At some point in the future, ophyd_async will have the feature to create the requested directory
if not os.path.isdir(panda_directory):
LOGGER.debug(f"Creating PandA PCAP subdirectory at {panda_directory}")
os.makedirs(panda_directory)
def update(self, directory: Path):
self._directory_info = DirectoryInfo(
root=directory, resource_dir=self.resource_dir
)
Expand Down
9 changes: 0 additions & 9 deletions tests/common/test_udc_directory_provider.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import os
import re
from pathlib import Path

Expand Down Expand Up @@ -45,11 +44,3 @@ def test_udc_directory_provider_after_update(initial, tmp_path):
directory_info = provider()
assert directory_info.root == tmp_path
assert directory_info.resource_dir == Path("panda")


def test_udc_directory_provider_update_creates_directory(tmp_path):
provider = PandASubdirectoryProvider()
new_directory = f"{tmp_path}/{provider.resource_dir}"
assert not os.path.isdir(new_directory)
provider.update(tmp_path, create_directory=True)
assert os.path.isdir(new_directory)

0 comments on commit ce03053

Please sign in to comment.