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

Enabling sdv logging causes tests to fail locally #2162

Closed
amontanez24 opened this issue Aug 1, 2024 · 0 comments · Fixed by #2170
Closed

Enabling sdv logging causes tests to fail locally #2162

amontanez24 opened this issue Aug 1, 2024 · 0 comments · Fixed by #2170
Assignees
Labels
bug Something isn't working internal The issue doesn't change the API or functionality
Milestone

Comments

@amontanez24
Copy link
Contributor

Environment Details

Please indicate the following details about the environment in which you found the bug:

  • SDV version: 1.15
  • Python version: All
  • Operating System: All

Error Description

If you enable logging by setting log_registry to 'local' in the sdv_logger_config.yml, the unit tests start to fail. This is because a lot of the unit tests use caplog to test the logs. Caplog adds a new handler to the logger. The first handler (the filehandler we use for sdv logs), modifies the log record here

def format(self, record): # noqa: A003
"""Format the record and write to CSV."""
row = record.msg
row['LEVEL'] = record.levelname
self.writer.writerow(row)

This causes the handler that caplog uses to have a different message than expected and thus the tests fail assertions

Steps to reproduce

  1. Set log_registry to 'local' on your config.
  2. run invoke unit
@amontanez24 amontanez24 added bug Something isn't working internal The issue doesn't change the API or functionality labels Aug 1, 2024
@amontanez24 amontanez24 self-assigned this Aug 9, 2024
@amontanez24 amontanez24 added this to the 1.15.1 milestone Aug 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working internal The issue doesn't change the API or functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant