conftest.py 550 B

1234567891011121314151617181920212223242526
  1. """
  2. Initialize logging for websocket_proxy tests.
  3. """
  4. import sys
  5. import os
  6. import logging
  7. from gpustack.logging import TRACE_LEVEL
  8. # Ensure local gpustack package is used
  9. repo_root = os.path.abspath(
  10. os.path.join(os.path.dirname(__file__), os.pardir, os.pardir)
  11. )
  12. if repo_root not in sys.path:
  13. sys.path.insert(0, repo_root)
  14. logging.addLevelName(TRACE_LEVEL, "TRACE")
  15. def trace(self, message, *args, **kwargs):
  16. if self.isEnabledFor(TRACE_LEVEL):
  17. self._log(TRACE_LEVEL, message, args, **kwargs)
  18. logging.Logger.trace = trace