Message202394
Comments on add_os_release_support_2.patch:
- You should not write a huge try/except OSError block. I would prefer something like:
try:
f = open(...)
except OSError:
return None
with f:
...
- I'm not sure about that, but you might use errors='surrogateescape', just in case if the file is not correctly encoded. Surrogate characters are maybe less annoying than a huge UnicodeDecodeError
- You use /etc/os-release even if the file is empty. Do you know if there is a standard, or something like that explaining if some keys are mandatory? For example, we can ignore os-release if 'ID' or 'VERSION_ID' key is missing
- For the unit test, you should write at least a test on linux_distribution() to check that your private function is used correctly
- You add unit tests for all escaped characters (', ", \), for comments, and maybe also for maformated lines (to have a well defined behaviour, ignore them or raise an error)
- _UNIXCONFDIR looks to be dedicated to unit tests, can't you patch builtin open() instead? It would avoid the need of a temporary directory |
|
Date |
User |
Action |
Args |
2013-11-07 23:15:52 | vstinner | set | recipients:
+ vstinner, lemburg, doko, christian.heimes, ezio.melotti, eric.araujo, Arfrever, vajrasky, elixir |
2013-11-07 23:15:52 | vstinner | set | messageid: <1383866152.38.0.93184898006.issue17762@psf.upfronthosting.co.za> |
2013-11-07 23:15:52 | vstinner | link | issue17762 messages |
2013-11-07 23:15:52 | vstinner | create | |
|