workhorsy / py-cpuinfo

A module for getting CPU info with pure Python
MIT License
312 stars 59 forks source link

Add test that checks data patterns of result #181

Open workhorsy opened 2 years ago

workhorsy commented 2 years ago

We just had a bug where getting cache sizes from lscpu broke from changes to lscpu. This was broken for 1.5 years without me noticing. The fields for cache, such as "l2_cache_size" where wrong:

We were getting:

# python string
"256 KiB (8 instances)"

instead of:

# python int
262144

If we update the test_actual, we can make sure we are getting sane results.

  1. Make sure results are correct data types
  2. Make sure results match regex pattern