Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleaning up and testing get_directory_index #483

Merged
merged 5 commits into from
Sep 25, 2024
Merged

Conversation

jamesbraza
Copy link
Collaborator

I found this code somewhat confusing, so I:

  1. Added more tests
  2. Improved variable names, removed locals, and added type hints

@jamesbraza jamesbraza added the enhancement New feature or request label Sep 25, 2024
@jamesbraza jamesbraza self-assigned this Sep 25, 2024
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Sep 25, 2024
@@ -343,7 +343,7 @@ async def maybe_get_manifest(
async with await anyio.open_file(filename, mode="r") as file:
content = await file.read()
records = [DocDetails(**row) for row in csv.DictReader(StringIO(content))]
logger.info(
logger.debug(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a bit noisy, so downgraded its level

paper_dir = cast(Path, agent_test_settings.paper_directory)
assert results[0].docs.keys() == {md5sum((paper_dir / "bates.txt").absolute())}
# Use a tempdir here so we can delete files without affecting concurrent tests
with tempfile.TemporaryDirectory() as tempdir:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have thought this fixture would handle that -- did you see deleting files affecting other tests?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah good question. I just expanded the explanatory comment to address this:

    # Since agent_test_settings is used by other tests, and thus uses the same
    # paper_directory as other tests, we use a tempdir so we can delete files
    # without affecting concurrent tests

Copy link
Collaborator

@mskarlin mskarlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Sep 25, 2024
@jamesbraza jamesbraza merged commit cdce7ce into main Sep 25, 2024
3 of 5 checks passed
@jamesbraza jamesbraza deleted the better-index-logic branch September 25, 2024 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants