test_sysinfo.py 493 B

1234567891011121314151617181920
  1. from case import skip
  2. from celery.utils.sysinfo import load_average, df
  3. @skip.unless_symbol('os.getloadavg')
  4. def test_load_average(patching):
  5. getloadavg = patching('os.getloadavg')
  6. getloadavg.return_value = 0.54736328125, 0.6357421875, 0.69921875
  7. l = load_average()
  8. assert l
  9. assert l == (0.55, 0.64, 0.7)
  10. @skip.unless_symbol('posix.statvfs_result')
  11. def test_df():
  12. x = df('/')
  13. assert x.total_blocks
  14. assert x.available
  15. assert x.capacity
  16. assert x.stat