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

feat: +unit test #663

Merged
merged 3 commits into from
Jan 2, 2024
Merged

feat: +unit test #663

merged 3 commits into from
Jan 2, 2024

Conversation

iorisa
Copy link
Collaborator

@iorisa iorisa commented Jan 2, 2024

Features

  • role.py, redis.py, s3.py, schema.py unit test

metagpt/utils/redis.py Outdated Show resolved Hide resolved
@pytest.mark.asyncio
async def test_s3_no_error():
key = CONFIG.S3_ACCESS_KEY
CONFIG.S3_ACCESS_KEY = "YOUR_S3_ACCESS_KEY"
Copy link
Owner

Choose a reason for hiding this comment

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

In a general sense, CONFIG is a read-only class and should not be writable

Copy link
Collaborator Author

@iorisa iorisa Jan 2, 2024

Choose a reason for hiding this comment

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

  1. CONFIG is a session-scoped context that supports both read and write operations.
  2. Config represents a configuration file and is read-only.
  3. The root cause of the issue here is the absence of the concept of a session in the console version. Therefore, the name CONFIG is used.
  4. To support the concept of a session functionally, the contextvars.ContextVar data type has been employed.
  5. All mock session options have been changed to use the set_context method.

Copy link
Owner

@geekan geekan Jan 2, 2024

Choose a reason for hiding this comment

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

There's going to be a bit tricky about that. The associated code needs to be refactored to be more straightforward. If it is a session concept, you should provide a session object, and use session.config or context.config in the session object to accurately express the context in which it is located. It needs to be refactored in the future, so you can put it here first

@iorisa iorisa requested a review from geekan January 2, 2024 08:27
Copy link
Owner

@geekan geekan left a comment

Choose a reason for hiding this comment

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

Here are a few legacy issues:

  1. Avoid using force push, which here seems to mask some historical commits
  2. Reduce the amount of changes to CONFIG, considering that it must be refactored

@geekan geekan merged commit d2260a5 into geekan:dev Jan 2, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants