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

Add get data dir function to ConfigManager #299

Merged
merged 2 commits into from
Dec 11, 2024
Merged

Conversation

nightlark
Copy link
Collaborator

Cherry-picked adding get_data_dir function to the ConfigManager from PR #267.

@nightlark nightlark added the enhancement New feature or request label Dec 11, 2024
@nightlark nightlark requested review from wangmot and Copilot December 11, 2024 17:31

Choose a reason for hiding this comment

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

Copilot reviewed 1 out of 1 changed files in this pull request and generated no suggestions.

Comments skipped due to low confidence (1)

surfactant/configmanager.py:145

  • The new function get_data_dir_path introduces new behavior that should be covered by tests. Please add tests to ensure this function works correctly on different platforms.
def get_data_dir_path(self) -> Path:

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no suggestions.

Comments skipped due to low confidence (2)

tests/config/test_configmanager.py:81

  • The environment variable used here should be 'LOCALAPPDATA' to match the implementation in 'get_data_dir_path'.
expected_data_dir = Path(os.getenv("APPDATA", str(Path("~\AppData\Local").expanduser())))

surfactant/configmanager.py:152

  • The environment variable LOCALAPPDATA is used here, but the test uses APPDATA. This inconsistency could lead to errors. Use APPDATA in both the code and the test.
data_dir = Path(os.getenv("LOCALAPPDATA", os.path.expanduser("~\AppData\Local")))
@nightlark nightlark force-pushed the add-get-data-dir branch 2 times, most recently from 8bbb60f to 9f962a1 Compare December 11, 2024 17:47
@nightlark nightlark requested a review from Copilot December 11, 2024 17:48
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 suggestion.

Comments skipped due to low confidence (3)

tests/config/test_configmanager.py:82

  • The test should assert that the data_dir path ends with the app_name to ensure the path is correctly formed.
assert expected_data_dir in data_dir.parents

tests/config/test_configmanager.py:92

  • The test should assert that the data_dir path ends with the app_name to ensure the path is correctly formed.
assert expected_data_dir in data_dir.parents

surfactant/configmanager.py:152

  • Inconsistent method usage for expanding user directory. Use Path().expanduser() for consistency.
data_dir = Path(os.getenv("LOCALAPPDATA", os.path.expanduser("~\AppData\Local")))

surfactant/configmanager.py Outdated Show resolved Hide resolved
@nightlark nightlark force-pushed the add-get-data-dir branch 2 times, most recently from e9bac44 to c74059b Compare December 11, 2024 18:08
@nightlark nightlark requested a review from Copilot December 11, 2024 18:11

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no suggestions.

@nightlark nightlark merged commit 2feea39 into main Dec 11, 2024
13 checks passed
@nightlark nightlark deleted the add-get-data-dir branch December 11, 2024 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants