The exception that is generated on parsing errors has changed in Python
3.12, match on the generic ValueError instead. Also switch to using
the simpler assertRaises() call instead of explicitly dealing with
exceptions.
Note that this is just a temporary workaround, we should really move
away for using pkg_resources completely, see [0] and [1].
[0] https://setuptools.pypa.io/en/latest/pkg_resources.html
[1] https://importlib-resources.readthedocs.io/en/latest/migration.html
Change-Id: I20422194f6fc6d1c4ba49da754a2c3aab99a282c