test_sysinfo.py 552 B

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