Repository navigation
fix(export): restore console log level after export completes #7947
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Fixed console log level not being restored after `reflex export` completes, which caused `reflex deploy` to hide progress messages. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -272,3 +272,46 @@ def require_release(*args, **kwargs): | |
| export.export() | ||
|
|
||
| assert context.__exit__.call_args.args[:2] == (RuntimeError, error) | ||
|
|
||
|
|
||
| def test_export_restores_log_level_on_success(patched_export): | ||
| """Console log level is restored after successful export.""" | ||
| from reflex_base.utils import console, log as _log | ||
|
|
||
| initial_level = constants.LogLevel.INFO | ||
| console.set_log_level(initial_level) | ||
| assert _log.get_log_level() == initial_level | ||
|
|
||
| export.export(loglevel=constants.LogLevel.DEBUG, zipping=False, frontend=False, backend=False) | ||
|
|
||
| assert _log.get_log_level() == initial_level | ||
|
|
||
|
|
||
| def test_export_restores_log_level_on_failure(patched_export): | ||
| """Console log level is restored even when export fails.""" | ||
| from reflex_base.utils import console, log as _log | ||
|
|
||
| initial_level = constants.LogLevel.INFO | ||
| console.set_log_level(initial_level) | ||
|
|
||
| patched_export["get_compiled_app"].side_effect = RuntimeError("Test error") | ||
|
|
||
| assert _log.get_log_level() == initial_level | ||
|
|
||
| with pytest.raises(RuntimeError, match="Test error"): | ||
| export.export(loglevel=constants.LogLevel.DEBUG, zipping=False, frontend=False, backend=False) | ||
|
|
||
| assert _log.get_log_level() == initial_level | ||
|
|
||
|
|
||
| def test_export_preserves_log_level_when_none_specified(patched_export): | ||
| """Console log level remains unchanged when loglevel=None.""" | ||
| from reflex_base.utils import console, log as _log | ||
|
|
||
| initial_level = constants.LogLevel.WARNING | ||
| console.set_log_level(initial_level) | ||
|
Comment on lines
+311
to
+312
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The new tests change the process-wide log level without restoring the level they found. The last test leaves |
||
| assert _log.get_log_level() == initial_level | ||
|
|
||
| export.export(loglevel=None, zipping=False, frontend=False, backend=False) | ||
|
|
||
| assert _log.get_log_level() == initial_level | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: Towncrier will ignore this fragment because root release notes are read from
news/, notchanges/; move it tonews/7947.bugfix.mdso the fix is included in the changelog.Prompt for AI agents