Repository: mlflow/mlflow

Issue:
Report disk usage during tests
### Summary

To find tests that consume lots of disk space, make the following change to report the disk usage:

```diff
diff --git a/conftest.py b/conftest.py
index 6f56d52f4..2c399c000 100644
--- a/conftest.py
+++ b/conftest.py
@@ -66,9 +66,18 @@ def pytest_report_teststatus(report, config):
 
         (*rest, result) = outcome.get_result()
         mem = psutil.virtual_memory()
-        used = mem.used / 1024**3
-        total = mem.total / 1024**3
-        outcome.force_result((*rest, f"{result} | mem {used:.1f}/{total:.1f} GB"))
+        mem_used = mem.used / 1024**3
+        mem_total = mem.total / 1024**3
+
+        disk = psutil.disk_usage("/")
+        disk_used = disk.used / 1024**3
+        disk_total = disk.total / 1024**3
+        outcome.force_result(
+            (
+                *rest,
+                f"{result} 🧠 {mem_used:.1f}/{mem_total:.1f} GB 💿 {disk_used:.1f}/{disk_total:.1f} GB",
+            )
+        )
 
 
 @pytest.hookimpl(hookwrapper=True)
```

### Notes

- Make sure to open a PR from a **non-master** branch.
- Sign off the commit using the `-s` flag when making a commit:

  ```sh
  git commit -s -m "..."
           # ^^ make sure to use this
  ```

- Include `#{issue_number}` (e.g. `#123`) in the PR description when opening a PR.
- Make sure to comment here before starting.



Discussion:
Hey @harupy 
I'm willing to help with this one!
@lightnessofbein thanks!

Resolving patch:
diff --git a/conftest.py b/conftest.py
--- a/conftest.py
+++ b/conftest.py
@@ -66,9 +66,22 @@ def pytest_report_teststatus(report, config):
 
         (*rest, result) = outcome.get_result()
         mem = psutil.virtual_memory()
-        used = mem.used / 1024**3
-        total = mem.total / 1024**3
-        outcome.force_result((*rest, f"{result} | mem {used:.1f}/{total:.1f} GB"))
+        mem_used = mem.used / 1024**3
+        mem_total = mem.total / 1024**3
+
+        disk = psutil.disk_usage("/")
+        disk_used = disk.used / 1024**3
+        disk_total = disk.total / 1024**3
+        outcome.force_result(
+            (
+                *rest,
+                (
+                    f"{result} | "
+                    f"MEM {mem_used:.1f}/{mem_total:.1f} GB | "
+                    f"DISK {disk_used:.1f}/{disk_total:.1f} GB"
+                ),
+            )
+        )
 
 
 @pytest.hookimpl(hookwrapper=True)


Test patch:
diff --git a/tests/examples/test_examples.py b/tests/examples/test_examples.py
--- a/tests/examples/test_examples.py
+++ b/tests/examples/test_examples.py
@@ -11,7 +11,7 @@
 from mlflow.utils import process
 from mlflow.utils.virtualenv import _get_mlflow_virtualenv_root
 
-from tests.helper_functions import clear_hub_cache, get_free_disk_space_in_GiB
+from tests.helper_functions import clear_hub_cache
 from tests.integration.utils import invoke_cli_runner
 
 EXAMPLES_DIR = "examples"
@@ -28,14 +28,6 @@ def replace_mlflow_with_dev_version(yml_path: Path) -> None:
     yml_path.write_text(new_src)
 
 
-@pytest.fixture(autouse=True)
-def report_free_disk_space(capsys):
-    yield
-
-    with capsys.disabled():
-        sys.stdout.write(f" | Free disk space: {get_free_disk_space_in_GiB():.1f} GiB")
-
-
 @pytest.fixture(autouse=True)
 def clean_up_mlflow_virtual_environments():
     yield
diff --git a/tests/helper_functions.py b/tests/helper_functions.py
--- a/tests/helper_functions.py
+++ b/tests/helper_functions.py
@@ -4,7 +4,6 @@
 import numbers
 import os
 import random
-import shutil
 import signal
 import socket
 import subprocess
@@ -636,7 +635,3 @@ def clear_hub_cache():
     except ImportError:
         # Local import check for mlflow-skinny not including huggingface_hub
         pass
-
-
-def get_free_disk_space_in_GiB():
-    return shutil.disk_usage("/").free / (1024**3)