mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
ui: Use sys.stdout and sys.stderr dynamically (#5729)
Before, we used to set it during initialization. But this made it hard to test using capsys as capsys changes the reference to sys.stdout and sys.stderr with the mocked one during the test. But since we are using dvc.ui globally and setting it to a real sys.stdout and sys.stderr before capsys comes into effect, testing was not possible with it. Now, by using property hack, we will be using the values of sys.stdout and sys.stderr during the time of write, so the mocking would work and would be easier to test.
This commit is contained in:
@@ -43,6 +43,13 @@ def reset_loglevel(request, caplog):
|
||||
yield
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def enable_ui():
|
||||
from dvc.ui import ui
|
||||
|
||||
ui.enable()
|
||||
|
||||
|
||||
@pytest.fixture(scope="session", autouse=True)
|
||||
def _close_pools():
|
||||
from dvc.fs.pool import close_pools
|
||||
|
||||
Reference in New Issue
Block a user